3
declare(strict_types=1);
6
* This file is part of CodeIgniter 4 framework.
8
* (c) CodeIgniter Foundation <admin@codeigniter.com>
10
* For the full copyright and license information, please view
11
* the LICENSE file that was distributed with this source code.
15
* ---------------------------------------------------------------
16
* This file cannot be used. The code has moved to Boot.php.
17
* ---------------------------------------------------------------
20
use CodeIgniter\Exceptions\FrameworkException;
26
header('HTTP/1.1 503 Service Unavailable.', true, 503);
28
$message = 'This "system/bootstrap.php" is no longer used. If you are seeing this error message,
29
the upgrade is not complete. Please refer to the upgrade guide and complete the upgrade.
30
See https://codeigniter4.github.io/userguide/installation/upgrade_450.html' . PHP_EOL;
34
* ---------------------------------------------------------------
35
* SETUP OUR PATH CONSTANTS
36
* ---------------------------------------------------------------
38
* The path constants provide convenient access to the folders
39
* throughout the application. We have to setup them up here
40
* so they are available in the config files that are loaded.
43
/** @var Paths $paths */
45
// The path to the application directory.
46
if (! defined('APPPATH')) {
47
define('APPPATH', realpath(rtrim($paths->appDirectory, '\\/ ')) . DIRECTORY_SEPARATOR);
50
// The path to the project root directory. Just above APPPATH.
51
if (! defined('ROOTPATH')) {
52
define('ROOTPATH', realpath(APPPATH . '../') . DIRECTORY_SEPARATOR);
55
// The path to the system directory.
56
if (! defined('SYSTEMPATH')) {
57
define('SYSTEMPATH', realpath(rtrim($paths->systemDirectory, '\\/ ')) . DIRECTORY_SEPARATOR);
60
// The path to the writable directory.
61
if (! defined('WRITEPATH')) {
62
define('WRITEPATH', realpath(rtrim($paths->writableDirectory, '\\/ ')) . DIRECTORY_SEPARATOR);
65
// The path to the tests directory
66
if (! defined('TESTPATH')) {
67
define('TESTPATH', realpath(rtrim($paths->testsDirectory, '\\/ ')) . DIRECTORY_SEPARATOR);
71
* ---------------------------------------------------------------
73
* ---------------------------------------------------------------
76
if (! defined('APP_NAMESPACE')) {
77
require_once APPPATH . 'Config/Constants.php';
81
* ---------------------------------------------------------------
82
* LOAD COMMON FUNCTIONS
83
* ---------------------------------------------------------------
86
// Require app/Common.php file if exists.
87
if (is_file(APPPATH . 'Common.php')) {
88
require_once APPPATH . 'Common.php';
91
// Require system/Common.php
92
require_once SYSTEMPATH . 'Common.php';
95
* ---------------------------------------------------------------
97
* ---------------------------------------------------------------
99
* The autoloader allows all of the pieces to work together in the
100
* framework. We have to load it here, though, so that the config
101
* files can use the path constants.
104
if (! class_exists(Autoload::class, false)) {
105
require_once SYSTEMPATH . 'Config/AutoloadConfig.php';
106
require_once APPPATH . 'Config/Autoload.php';
107
require_once SYSTEMPATH . 'Modules/Modules.php';
108
require_once APPPATH . 'Config/Modules.php';
111
require_once SYSTEMPATH . 'Autoloader/Autoloader.php';
112
require_once SYSTEMPATH . 'Config/BaseService.php';
113
require_once SYSTEMPATH . 'Config/Services.php';
114
require_once APPPATH . 'Config/Services.php';
116
// Initialize and register the loader with the SPL autoloader stack.
117
Services::autoloader()->initialize(new Autoload(), new Modules())->register();
118
Services::autoloader()->loadHelpers();
121
* ---------------------------------------------------------------
122
* SET EXCEPTION AND ERROR HANDLERS
123
* ---------------------------------------------------------------
126
Services::exceptions()->initialize();
129
* ---------------------------------------------------------------
130
* CHECK SYSTEM FOR MISSING REQUIRED PHP EXTENSIONS
131
* ---------------------------------------------------------------
134
// Run this check for manual installations
135
if (! is_file(COMPOSER_PATH)) {
136
$missingExtensions = [];
143
if (! extension_loaded($extension)) {
144
$missingExtensions[] = $extension;
148
if ($missingExtensions !== []) {
149
throw FrameworkException::forMissingExtension(implode(', ', $missingExtensions));
152
unset($missingExtensions);
156
* ---------------------------------------------------------------
158
* ---------------------------------------------------------------
161
Services::autoloader()->initializeKint(CI_DEBUG);