-
Notifications
You must be signed in to change notification settings - Fork 5
/
bootstrap.php
executable file
·46 lines (43 loc) · 1.3 KB
/
bootstrap.php
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
<?php
/**
* Step 1: Initial constants defined
*
* Several constants defined in order to help
* with the autoloader and the loading of other
* needed functions and files.
*/
defined('DS') or define('DS', DIRECTORY_SEPARATOR);
if (! defined('BASE_PATH')) {
define('BASE_PATH', dirname(__FILE__) . DS);
}
/**
* Step 2: Check PHP version.
*/
if (version_compare($ver = PHP_VERSION, $req = 7.1, '<')) {
die(sprintf('You are running PHP %s, but TriTan CMS requires at least <strong>PHP %s</strong> to run.', $ver, $req));
}
/**
* Step 3: Require the autoloader
*
* The autoloader includes the Liten framework as well as
* other libraries TriTan CMS needs to work.
*/
$autoload = BASE_PATH . 'vendor' . DS . 'autoload.php';
if (!is_file($autoload)) {
die("Please run: <i>composer update</i> to install dependencies");
}
require_once($autoload);
/**
* Step 4: Include config file
*/
if (file_exists(BASE_PATH . 'config.php')) {
/**
* Our config file is located in its normal place.
*/
require_once(BASE_PATH . 'config.php');
} elseif (file_exists(dirname(BASE_PATH) . DS . 'config.php') && !file_exists(dirname(BASE_PATH) . DS . 'settings.php')) {
/**
* Our config file is one level up from the base directory.
*/
require_once(dirname(BASE_PATH) . DS . 'config.php');
}