ci4

Форк
0
/
bootstrap.php 
163 строки · 4.8 Кб
1
<?php
2

3
declare(strict_types=1);
4

5
/**
6
 * This file is part of CodeIgniter 4 framework.
7
 *
8
 * (c) CodeIgniter Foundation <admin@codeigniter.com>
9
 *
10
 * For the full copyright and license information, please view
11
 * the LICENSE file that was distributed with this source code.
12
 */
13

14
/**
15
 * ---------------------------------------------------------------
16
 * This file cannot be used. The code has moved to Boot.php.
17
 * ---------------------------------------------------------------
18
 */
19

20
use CodeIgniter\Exceptions\FrameworkException;
21
use Config\Autoload;
22
use Config\Modules;
23
use Config\Paths;
24
use Config\Services;
25

26
header('HTTP/1.1 503 Service Unavailable.', true, 503);
27

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;
31
echo $message;
32

33
/*
34
 * ---------------------------------------------------------------
35
 * SETUP OUR PATH CONSTANTS
36
 * ---------------------------------------------------------------
37
 *
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.
41
 */
42

43
/** @var Paths $paths */
44

45
// The path to the application directory.
46
if (! defined('APPPATH')) {
47
    define('APPPATH', realpath(rtrim($paths->appDirectory, '\\/ ')) . DIRECTORY_SEPARATOR);
48
}
49

50
// The path to the project root directory. Just above APPPATH.
51
if (! defined('ROOTPATH')) {
52
    define('ROOTPATH', realpath(APPPATH . '../') . DIRECTORY_SEPARATOR);
53
}
54

55
// The path to the system directory.
56
if (! defined('SYSTEMPATH')) {
57
    define('SYSTEMPATH', realpath(rtrim($paths->systemDirectory, '\\/ ')) . DIRECTORY_SEPARATOR);
58
}
59

60
// The path to the writable directory.
61
if (! defined('WRITEPATH')) {
62
    define('WRITEPATH', realpath(rtrim($paths->writableDirectory, '\\/ ')) . DIRECTORY_SEPARATOR);
63
}
64

65
// The path to the tests directory
66
if (! defined('TESTPATH')) {
67
    define('TESTPATH', realpath(rtrim($paths->testsDirectory, '\\/ ')) . DIRECTORY_SEPARATOR);
68
}
69

70
/*
71
 * ---------------------------------------------------------------
72
 * GRAB OUR CONSTANTS
73
 * ---------------------------------------------------------------
74
 */
75

76
if (! defined('APP_NAMESPACE')) {
77
    require_once APPPATH . 'Config/Constants.php';
78
}
79

80
/*
81
 * ---------------------------------------------------------------
82
 * LOAD COMMON FUNCTIONS
83
 * ---------------------------------------------------------------
84
 */
85

86
// Require app/Common.php file if exists.
87
if (is_file(APPPATH . 'Common.php')) {
88
    require_once APPPATH . 'Common.php';
89
}
90

91
// Require system/Common.php
92
require_once SYSTEMPATH . 'Common.php';
93

94
/*
95
 * ---------------------------------------------------------------
96
 * LOAD OUR AUTOLOADER
97
 * ---------------------------------------------------------------
98
 *
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.
102
 */
103

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';
109
}
110

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';
115

116
// Initialize and register the loader with the SPL autoloader stack.
117
Services::autoloader()->initialize(new Autoload(), new Modules())->register();
118
Services::autoloader()->loadHelpers();
119

120
/*
121
 * ---------------------------------------------------------------
122
 * SET EXCEPTION AND ERROR HANDLERS
123
 * ---------------------------------------------------------------
124
 */
125

126
Services::exceptions()->initialize();
127

128
/*
129
 * ---------------------------------------------------------------
130
 * CHECK SYSTEM FOR MISSING REQUIRED PHP EXTENSIONS
131
 * ---------------------------------------------------------------
132
 */
133

134
// Run this check for manual installations
135
if (! is_file(COMPOSER_PATH)) {
136
    $missingExtensions = [];
137

138
    foreach ([
139
        'intl',
140
        'json',
141
        'mbstring',
142
    ] as $extension) {
143
        if (! extension_loaded($extension)) {
144
            $missingExtensions[] = $extension;
145
        }
146
    }
147

148
    if ($missingExtensions !== []) {
149
        throw FrameworkException::forMissingExtension(implode(', ', $missingExtensions));
150
    }
151

152
    unset($missingExtensions);
153
}
154

155
/*
156
 * ---------------------------------------------------------------
157
 * INITIALIZE KINT
158
 * ---------------------------------------------------------------
159
 */
160

161
Services::autoloader()->initializeKint(CI_DEBUG);
162

163
exit(1);
164

Использование cookies

Мы используем файлы cookie в соответствии с Политикой конфиденциальности и Политикой использования cookies.

Нажимая кнопку «Принимаю», Вы даете АО «СберТех» согласие на обработку Ваших персональных данных в целях совершенствования нашего веб-сайта и Сервиса GitVerse, а также повышения удобства их использования.

Запретить использование cookies Вы можете самостоятельно в настройках Вашего браузера.