-
Notifications
You must be signed in to change notification settings - Fork 1
/
octolab
53 lines (39 loc) · 1.62 KB
/
octolab
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
<?php
namespace Octo;
ini_set('error_reporting', E_ALL);
ini_set('display_errors', true);
$ini = parse_ini_file(__DIR__ . '/.env');
defined('APPLICATION_ENV') || define('APPLICATION_ENV', isset($ini['APPLICATION_ENV']) ? $ini['APPLICATION_ENV'] : 'production');
defined('SITE_NAME') || define('SITE_NAME', isset($ini['SITE_NAME']) ? $ini['SITE_NAME'] : 'project');
require_once realpath(__DIR__) . '/vendor/autoload.php';
path("app", realpath(__DIR__ . '/app'));
path("base", realpath(__DIR__));
systemBoot(__DIR__);
try {
Octo::cli();
} catch (\Exception $e) {
$debug = Config::get("debug", true);
if (true === $debug) {
ob_start();
echo '<h1><i class="fa fa-info-circle fa-2x"></i> Infos</h1>';
$infos = Registry::get('BACKTRACE', $e->getTrace());
echo '<pre>';
var_dump($infos);
echo '</pre>';
$trace = ob_et_clean();
$html = '<h1><i class="fa fa-warning fa-2x"></i> Error to boot Octo</h1>';
$html .= 'Please read the next message to fix.';
$html .= '<div style="margin-top: 15px;" class="alert alert-danger">
' . $e->getMessage();
if (!Registry::has('BACKTRACE')) {
$html .= '<hr>in ' . $e->getFile() . ' (line: ' . $e->getLine() . ')';
}
$html .= '</div><hr>' . $trace . '';
view($html, 500, 'Octo Error Report');
}
}
if (count($argv) > 1) {
new Octolabs($argv);
} else {
Cli::show("Octolab requires an action", 'ERROR');
}