Skip to content

Commit a0e9741

Browse files
committed
Updated loader and composer script to use Kint 3.3 for #2373
1 parent 3e97caf commit a0e9741

95 files changed

Lines changed: 10440 additions & 165 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
"ext-curl": "*",
1010
"ext-intl": "*",
1111
"ext-json": "*",
12-
"kint-php/kint": "^2.1",
12+
"kint-php/kint": "^3.3",
1313
"psr/log": "^1.1",
1414
"laminas/laminas-escaper": "^2.6"
1515
},

system/Autoloader/Autoloader.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -423,6 +423,12 @@ protected function discoverComposerNamespaces()
423423
unset($paths['CodeIgniter\\']);
424424
}
425425

426+
// Also get rid of Kint to ensure we use our own copy
427+
if (isset($paths['Kint\\']))
428+
{
429+
unset($paths['Kint\\']);
430+
}
431+
426432
// Composer stores namespaces with trailing slash. We don't.
427433
$newPaths = [];
428434
foreach ($paths as $key => $value)

system/CodeIgniter.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,8 @@ public function initialize()
192192

193193
if (CI_DEBUG)
194194
{
195-
require_once SYSTEMPATH . 'ThirdParty/Kint/kint.php';
195+
require_once SYSTEMPATH . 'ThirdParty/Kint/init.php';
196+
\Kint\Renderer\RichRenderer::$theme = 'aante-light.css';
196197
}
197198
}
198199

system/ComposerScripts.php

Lines changed: 29 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,29 @@ protected static function removeDir($dir)
149149
}
150150
}
151151

152+
protected static function copyDir($source, $dest)
153+
{
154+
$dir = opendir($source);
155+
@mkdir($dest);
156+
157+
while (false !== ( $file = readdir($dir)))
158+
{
159+
if (( $file !== '.' ) && ( $file !== '..' ))
160+
{
161+
if (is_dir($source . '/' . $file))
162+
{
163+
static::copyDir($source . '/' . $file, $dest . '/' . $file);
164+
}
165+
else
166+
{
167+
copy($source . '/' . $file, $dest . '/' . $file);
168+
}
169+
}
170+
}
171+
172+
closedir($dir);
173+
}
174+
152175
/**
153176
* Moves the Laminas Escaper files into our base repo so that it's
154177
* available for packaged releases where the users don't user Composer.
@@ -194,9 +217,9 @@ public static function moveEscaper()
194217
*/
195218
public static function moveKint()
196219
{
197-
$filename = 'vendor/kint-php/kint/build/kint-aante-light.php';
220+
$dir = 'vendor/kint-php/kint/src';
198221

199-
if (is_file($filename))
222+
if (is_dir($dir))
200223
{
201224
$base = basename(__DIR__) . '/' . static::$basePath . 'Kint';
202225

@@ -212,10 +235,10 @@ public static function moveKint()
212235
mkdir($base, 0755);
213236
}
214237

215-
if (! static::moveFile($filename, $base . '/kint.php'))
216-
{
217-
die('Error moving: ' . $filename);
218-
}
238+
static::copyDir($dir, $base);
239+
static::copyDir($dir . '/../resources', $base . '/resources');
240+
copy($dir . '/../init.php', $base . '/init.php');
241+
copy($dir . '/../init_helpers.php', $base . '/init_helpers.php');
219242
}
220243
}
221244
}

system/Config/AutoloadConfig.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,7 @@ public function __construct()
9292
*/
9393
$this->psr4 = [
9494
'CodeIgniter' => realpath(SYSTEMPATH),
95+
'Kint' => SYSTEMPATH . 'ThirdParty/Kint',
9596
];
9697

9798
if (isset($_SERVER['CI_ENVIRONMENT']) && $_SERVER['CI_ENVIRONMENT'] === 'testing')

0 commit comments

Comments
 (0)