From 08a4eb3f205633881ec149811264b8f0cad753af Mon Sep 17 00:00:00 2001 From: "John Paul E. Balandan, CPA" Date: Sun, 22 Feb 2026 17:24:52 +0800 Subject: [PATCH] refactor: remove deprecated `system/bootstrap.php` --- system/bootstrap.php | 162 -------------------- tests/system/Autoloader/FileLocatorTest.php | 2 +- user_guide_src/source/changelogs/v4.8.0.rst | 1 + 3 files changed, 2 insertions(+), 163 deletions(-) delete mode 100644 system/bootstrap.php diff --git a/system/bootstrap.php b/system/bootstrap.php deleted file mode 100644 index 73a12ea803a6..000000000000 --- a/system/bootstrap.php +++ /dev/null @@ -1,162 +0,0 @@ - - * - * For the full copyright and license information, please view - * the LICENSE file that was distributed with this source code. - */ - -/** - * --------------------------------------------------------------- - * This file cannot be used. The code has moved to Boot.php. - * --------------------------------------------------------------- - */ - -use Config\Autoload; -use Config\Modules; -use Config\Paths; -use Config\Services; - -header('HTTP/1.1 503 Service Unavailable.', true, 503); - -$message = 'This "system/bootstrap.php" is no longer used. If you are seeing this error message, -the upgrade is not complete. Please refer to the upgrade guide and complete the upgrade. -See https://codeigniter4.github.io/userguide/installation/upgrade_450.html' . PHP_EOL; -echo $message; - -/* - * --------------------------------------------------------------- - * SETUP OUR PATH CONSTANTS - * --------------------------------------------------------------- - * - * The path constants provide convenient access to the folders - * throughout the application. We have to setup them up here - * so they are available in the config files that are loaded. - */ - -/** @var Paths $paths */ - -// The path to the application directory. -if (! defined('APPPATH')) { - define('APPPATH', realpath(rtrim($paths->appDirectory, '\\/ ')) . DIRECTORY_SEPARATOR); -} - -// The path to the project root directory. Just above APPPATH. -if (! defined('ROOTPATH')) { - define('ROOTPATH', realpath(APPPATH . '../') . DIRECTORY_SEPARATOR); -} - -// The path to the system directory. -if (! defined('SYSTEMPATH')) { - define('SYSTEMPATH', realpath(rtrim($paths->systemDirectory, '\\/ ')) . DIRECTORY_SEPARATOR); -} - -// The path to the writable directory. -if (! defined('WRITEPATH')) { - define('WRITEPATH', realpath(rtrim($paths->writableDirectory, '\\/ ')) . DIRECTORY_SEPARATOR); -} - -// The path to the tests directory -if (! defined('TESTPATH')) { - define('TESTPATH', realpath(rtrim($paths->testsDirectory, '\\/ ')) . DIRECTORY_SEPARATOR); -} - -/* - * --------------------------------------------------------------- - * GRAB OUR CONSTANTS - * --------------------------------------------------------------- - */ - -if (! defined('APP_NAMESPACE')) { - require_once APPPATH . 'Config/Constants.php'; -} - -/* - * --------------------------------------------------------------- - * LOAD COMMON FUNCTIONS - * --------------------------------------------------------------- - */ - -// Require app/Common.php file if exists. -if (is_file(APPPATH . 'Common.php')) { - require_once APPPATH . 'Common.php'; -} - -// Require system/Common.php -require_once SYSTEMPATH . 'Common.php'; - -/* - * --------------------------------------------------------------- - * LOAD OUR AUTOLOADER - * --------------------------------------------------------------- - * - * The autoloader allows all of the pieces to work together in the - * framework. We have to load it here, though, so that the config - * files can use the path constants. - */ - -if (! class_exists(Autoload::class, false)) { - require_once SYSTEMPATH . 'Config/AutoloadConfig.php'; - require_once APPPATH . 'Config/Autoload.php'; - require_once SYSTEMPATH . 'Modules/Modules.php'; - require_once APPPATH . 'Config/Modules.php'; -} - -require_once SYSTEMPATH . 'Autoloader/Autoloader.php'; -require_once SYSTEMPATH . 'Config/BaseService.php'; -require_once SYSTEMPATH . 'Config/Services.php'; -require_once APPPATH . 'Config/Services.php'; - -// Initialize and register the loader with the SPL autoloader stack. -Services::autoloader()->initialize(new Autoload(), new Modules())->register(); -Services::autoloader()->loadHelpers(); - -/* - * --------------------------------------------------------------- - * SET EXCEPTION AND ERROR HANDLERS - * --------------------------------------------------------------- - */ - -Services::exceptions()->initialize(); - -/* - * --------------------------------------------------------------- - * CHECK SYSTEM FOR MISSING REQUIRED PHP EXTENSIONS - * --------------------------------------------------------------- - */ - -// Run this check for manual installations -if (! is_file(COMPOSER_PATH)) { - $missingExtensions = []; - - foreach (['intl', 'json', 'mbstring'] as $extension) { - if (! extension_loaded($extension)) { - $missingExtensions[] = $extension; - } - } - - if ($missingExtensions !== []) { - throw new RuntimeException(sprintf( - 'The framework needs the following extension%s installed and loaded: "%s".', - count($missingExtensions) > 1 ? 's' : '', - implode('", "', $missingExtensions), - )); - } - - unset($missingExtensions); -} - -/* - * --------------------------------------------------------------- - * INITIALIZE KINT - * --------------------------------------------------------------- - */ - -Services::autoloader()->initializeKint(CI_DEBUG); - -exit(1); diff --git a/tests/system/Autoloader/FileLocatorTest.php b/tests/system/Autoloader/FileLocatorTest.php index fc7925724add..07bca58683fb 100644 --- a/tests/system/Autoloader/FileLocatorTest.php +++ b/tests/system/Autoloader/FileLocatorTest.php @@ -316,7 +316,7 @@ public function testGetClassNameFromNonClassFile(): void { $this->assertSame( '', - $this->locator->getClassname(SYSTEMPATH . 'bootstrap.php'), + $this->locator->getClassname(SYSTEMPATH . 'util_bootstrap.php'), ); } diff --git a/user_guide_src/source/changelogs/v4.8.0.rst b/user_guide_src/source/changelogs/v4.8.0.rst index 95e306063380..372ccd62c4a1 100644 --- a/user_guide_src/source/changelogs/v4.8.0.rst +++ b/user_guide_src/source/changelogs/v4.8.0.rst @@ -50,6 +50,7 @@ Removed Deprecated Items - **Autoloader:** Removed the following deprecated methods: - ``CodeIgniter\Autoloader\Autoloader::sanitizeFileName()`` - ``CodeIgniter\Autoloader\Autoloader::discoverComposerNamespaces()`` +- **Bootstrap:** The deprecated **system/bootstrap.php** file has been removed. - **Cache:** Removed the following methods deprecated since v4.6.0: - ``CodeIgniter\Cache\Handlers\FileHandler::writeFile()`` - ``CodeIgniter\Cache\Handlers\FileHandler::deleteFile()``