This repository was archived by the owner on Jan 19, 2021. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathbootstrap.php
More file actions
46 lines (34 loc) · 1.29 KB
/
bootstrap.php
File metadata and controls
46 lines (34 loc) · 1.29 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
<?php
require __DIR__.'/constants.php';
defined('DS') or exit('No direct script access allowed.');
ini_get('date.timezone') or date_default_timezone_set('UTC');
require __DIR__.'/system/Core/Config.php';
require __DIR__.'/system/Support/polyfill.php';
require __DIR__.'/system/Debugger/autoload.php';
require __DIR__.'/system/Support/helpers.php';
require __DIR__.'/system/Loader/Autoloader.php';
use System\Core\Config;
use System\Debugger\Debugger;
use System\Loader\Autoloader;
Config::initialize();
if (is_null(Config::get('app.base_url', null))) {
if (!is_cli()) {
$base = ((isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] === 'on') ? 'https' : 'http');
$base .= '://'.$_SERVER['HTTP_HOST'];
$base .= str_replace(basename($_SERVER['SCRIPT_NAME']), '', $_SERVER['SCRIPT_NAME']);
Config::set('app.base_url', $base);
} else {
Config::set('app.base_url', null);
}
} else {
$base = Config::get('app.base_url');
$base = rtrim($base, '/').'/';
Config::set('app.base_url', $base);
}
$logs = storage_path('system/logs');
if (!is_dir($logs) && false === @mkdir($logs, 0777, true)) {
throw new RuntimeException('Unable to create logs directory: '.$logs);
}
Debugger::enable(Debugger::DETECT || is_cli(), $logs);
unset($logs);
Autoloader::register();