refactor: move CodeIgniter::resolvePlatformExtensions() to bootstrap.php

This commit is contained in:
kenjis 2024-02-18 22:23:48 +09:00
parent 66c81bcc13
commit 83c15b90de
No known key found for this signature in database
GPG Key ID: BD254878922AF198
2 changed files with 36 additions and 6 deletions

View File

@ -186,11 +186,6 @@ class CodeIgniter
*/
public function initialize()
{
// Run this check for manual installations
if (! is_file(COMPOSER_PATH)) {
$this->resolvePlatformExtensions(); // @codeCoverageIgnore
}
// Set default locale on the server
Locale::setDefault($this->config->defaultLocale ?? 'en');
@ -206,6 +201,8 @@ class CodeIgniter
* @throws FrameworkException
*
* @codeCoverageIgnore
*
* @deprecated 4.5.0 Moved to system/bootstrap.php.
*/
protected function resolvePlatformExtensions()
{

View File

@ -11,6 +11,7 @@ declare(strict_types=1);
* the LICENSE file that was distributed with this source code.
*/
use CodeIgniter\Exceptions\FrameworkException;
use Config\Autoload;
use Config\Modules;
use Config\Paths;
@ -144,5 +145,37 @@ Services::autoloader()->loadHelpers();
Services::exceptions()->initialize();
// Initialize Kint
/*
* ---------------------------------------------------------------
* CHECK SYSTEM FOR MISSING REQUIRED PHP EXTENSIONS
* ---------------------------------------------------------------
*/
// Run this check for manual installations
if (! is_file(COMPOSER_PATH)) {
$requiredExtensions = [
'intl',
'json',
'mbstring',
];
$missingExtensions = [];
foreach ($requiredExtensions as $extension) {
if (! extension_loaded($extension)) {
$missingExtensions[] = $extension;
}
}
if ($missingExtensions !== []) {
throw FrameworkException::forMissingExtension(implode(', ', $missingExtensions));
}
}
/*
* ---------------------------------------------------------------
* INITIALIZE KINT
* ---------------------------------------------------------------
*/
Services::autoloader()->initializeKint(CI_DEBUG);