ci4

Форк
0
/
bootstrap.php 
91 строка · 3.5 Кб
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
use CodeIgniter\Boot;
15
use Config\Paths;
16
use Config\Services;
17

18
error_reporting(E_ALL);
19
ini_set('display_errors', '1');
20
ini_set('display_startup_errors', '1');
21

22
/*
23
 * ---------------------------------------------------------------
24
 * DEFINE ENVIRONMENT
25
 * ---------------------------------------------------------------
26
 */
27

28
// Make sure it recognizes that we're testing.
29
$_SERVER['CI_ENVIRONMENT'] = 'testing';
30
define('ENVIRONMENT', 'testing');
31

32
defined('CI_DEBUG') || define('CI_DEBUG', true);
33

34
/*
35
 * ---------------------------------------------------------------
36
 * SET UP OUR PATH CONSTANTS
37
 * ---------------------------------------------------------------
38
 *
39
 * The path constants provide convenient access to the folders
40
 * throughout the application. We have to set them up here
41
 * so they are available in the config files that are loaded.
42
 */
43

44
// Often these constants are pre-defined, but query the current directory structure as a fallback
45
defined('HOMEPATH') || define('HOMEPATH', realpath(rtrim(getcwd(), '\\/ ')) . DIRECTORY_SEPARATOR);
46
$source = is_dir(HOMEPATH . 'app')
47
    ? HOMEPATH
48
    : (is_dir('vendor/codeigniter4/framework/') ? 'vendor/codeigniter4/framework/' : 'vendor/codeigniter4/codeigniter4/');
49
defined('CONFIGPATH') || define('CONFIGPATH', realpath($source . 'app/Config') . DIRECTORY_SEPARATOR);
50
defined('PUBLICPATH') || define('PUBLICPATH', realpath($source . 'public') . DIRECTORY_SEPARATOR);
51
unset($source);
52

53
// LOAD OUR PATHS CONFIG FILE
54
// Load framework paths from their config file
55
require CONFIGPATH . 'Paths.php';
56
$paths = new Paths();
57

58
// Define necessary framework path constants
59
defined('APPPATH')    || define('APPPATH', realpath(rtrim($paths->appDirectory, '\\/ ')) . DIRECTORY_SEPARATOR);
60
defined('ROOTPATH')   || define('ROOTPATH', realpath(APPPATH . '../') . DIRECTORY_SEPARATOR);
61
defined('SYSTEMPATH') || define('SYSTEMPATH', realpath(rtrim($paths->systemDirectory, '\\/')) . DIRECTORY_SEPARATOR);
62
defined('WRITEPATH')  || define('WRITEPATH', realpath(rtrim($paths->writableDirectory, '\\/ ')) . DIRECTORY_SEPARATOR);
63
defined('TESTPATH')   || define('TESTPATH', realpath(HOMEPATH . 'tests/') . DIRECTORY_SEPARATOR);
64

65
defined('CIPATH') || define('CIPATH', realpath(SYSTEMPATH . '../') . DIRECTORY_SEPARATOR);
66
defined('FCPATH') || define('FCPATH', realpath(PUBLICPATH) . DIRECTORY_SEPARATOR);
67

68
defined('SUPPORTPATH')   || define('SUPPORTPATH', realpath(TESTPATH . '_support/') . DIRECTORY_SEPARATOR);
69
defined('COMPOSER_PATH') || define('COMPOSER_PATH', (string) realpath(HOMEPATH . 'vendor/autoload.php'));
70
defined('VENDORPATH')    || define('VENDORPATH', realpath(HOMEPATH . 'vendor') . DIRECTORY_SEPARATOR);
71

72
/*
73
 *---------------------------------------------------------------
74
 * BOOTSTRAP THE APPLICATION
75
 *---------------------------------------------------------------
76
 * This process sets up the path constants, loads and registers
77
 * our autoloader, along with Composer's, loads our constants
78
 * and fires up an environment-specific bootstrapping.
79
 */
80

81
// LOAD THE FRAMEWORK BOOTSTRAP FILE
82
require $paths->systemDirectory . '/Boot.php';
83
Boot::bootTest($paths);
84

85
/*
86
 * ---------------------------------------------------------------
87
 * LOAD ROUTES
88
 * ---------------------------------------------------------------
89
 */
90

91
Services::routes()->loadRoutes();
92

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

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

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

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