-
Notifications
You must be signed in to change notification settings - Fork 2k
Expand file tree
/
Copy pathutil_bootstrap.php
More file actions
84 lines (68 loc) · 2.92 KB
/
util_bootstrap.php
File metadata and controls
84 lines (68 loc) · 2.92 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
<?php
declare(strict_types=1);
/**
* This file is part of CodeIgniter 4 framework.
*
* (c) CodeIgniter Foundation <admin@codeigniter.com>
*
* For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code.
*/
use CodeIgniter\Boot;
use Config\Paths;
error_reporting(E_ALL);
ini_set('display_errors', '1');
ini_set('display_startup_errors', '1');
/*
* ---------------------------------------------------------------
* DEFINE ENVIRONMENT
* ---------------------------------------------------------------
*
* As this bootstrap file is primarily used by internal scripts
* across the framework and other CodeIgniter projects, we need
* to make sure it recognizes that we're in development.
*/
$_SERVER['CI_ENVIRONMENT'] = 'development';
define('ENVIRONMENT', 'development');
defined('CI_DEBUG') || define('CI_DEBUG', true);
/*
* ---------------------------------------------------------------
* SET UP OUR PATH CONSTANTS
* ---------------------------------------------------------------
*
* The path constants provide convenient access to the folders
* throughout the application. We have to set them up here
* so they are available in the config files that are loaded.
*/
defined('HOMEPATH') || define('HOMEPATH', realpath(rtrim(getcwd(), '\\/ ')) . DIRECTORY_SEPARATOR);
$source = match (true) {
is_dir(HOMEPATH . 'app/') => HOMEPATH,
is_dir('vendor/codeigniter4/framework/') => 'vendor/codeigniter4/framework/',
is_dir('vendor/codeigniter4/codeigniter4/') => 'vendor/codeigniter4/codeigniter4/',
default => throw new RuntimeException('Unable to determine the source directory.'),
};
defined('CONFIGPATH') || define('CONFIGPATH', realpath($source . 'app/Config') . DIRECTORY_SEPARATOR);
defined('PUBLICPATH') || define('PUBLICPATH', realpath($source . 'public') . DIRECTORY_SEPARATOR);
unset($source);
require CONFIGPATH . 'Paths.php';
$paths = new Paths();
defined('CIPATH') || define('CIPATH', realpath($paths->systemDirectory . '/../') . DIRECTORY_SEPARATOR);
defined('FCPATH') || define('FCPATH', PUBLICPATH);
if (is_dir($paths->testsDirectory . '/_support/') && ! defined('SUPPORTPATH')) {
define('SUPPORTPATH', realpath($paths->testsDirectory . '/_support/') . DIRECTORY_SEPARATOR);
}
if (is_dir(HOMEPATH . 'vendor/')) {
define('VENDORPATH', realpath(HOMEPATH . 'vendor/') . DIRECTORY_SEPARATOR);
define('COMPOSER_PATH', (string) realpath(HOMEPATH . 'vendor/autoload.php'));
}
/*
*---------------------------------------------------------------
* BOOTSTRAP THE APPLICATION
*---------------------------------------------------------------
*
* This process sets up the path constants, loads and registers
* our autoloader, along with Composer's, loads our constants
* and fires up an environment-specific bootstrapping.
*/
require $paths->systemDirectory . '/Boot.php';
Boot::bootConsole($paths);