forked from eventum/eventum
-
Notifications
You must be signed in to change notification settings - Fork 0
/
autoload.php
39 lines (30 loc) · 1.13 KB
/
autoload.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
<?php
/*
* This file is part of the Eventum (Issue Tracking System) package.
*
* @copyright (c) Eventum Team
* @license GNU General Public License, version 2 or later (GPL-2+)
*
* For the full copyright and license information,
* please see the COPYING and AUTHORS files
* that were distributed with this source code.
*/
use Eventum\Kernel;
$autoload = null;
foreach ([__DIR__ . '/vendor/autoload.php', __DIR__ . '/../../../vendor/autoload.php'] as $autoload) {
if (file_exists($autoload)) {
break;
}
}
if (!file_exists($autoload)) {
echo <<<EOF
You must set up the project dependencies, run the following commands:
$ curl -sS https://getcomposer.org/installer | php
$ php composer.phar install
EOF;
exit(1);
}
require $autoload;
$_SERVER['APP_ENV'] = $_ENV['APP_ENV'] = ($_SERVER['APP_ENV'] ?? $_ENV['APP_ENV'] ?? null) ?: Kernel::DEFAULT_ENVIRONMENT;
$_SERVER['APP_DEBUG'] = $_SERVER['APP_DEBUG'] ?? $_ENV['APP_DEBUG'] ?? 'prod' !== $_SERVER['APP_ENV'];
$_SERVER['APP_DEBUG'] = $_ENV['APP_DEBUG'] = (int)$_SERVER['APP_DEBUG'] || filter_var($_SERVER['APP_DEBUG'], FILTER_VALIDATE_BOOLEAN) ? '1' : '0';