|
|
@ -3,19 +3,29 @@ |
|
|
|
// PHP |
|
|
|
// PHP |
|
|
|
declare(strict_types=1); |
|
|
|
declare(strict_types=1); |
|
|
|
|
|
|
|
|
|
|
|
// Environment |
|
|
|
// Init environment |
|
|
|
if (!empty($_SERVER['PHP_ENV']) && file_exists(sprintf('%s/env.%s.php', __DIR__, $_SERVER['PHP_ENV']))) |
|
|
|
if (empty($_SERVER['PHP_ENV'])) |
|
|
|
{ |
|
|
|
{ |
|
|
|
require_once sprintf('%s/env.%s.php', __DIR__, $_SERVER['PHP_ENV']); |
|
|
|
$_SERVER['PHP_ENV'] = 'default'; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
else require_once __DIR__ . '/env.default.php'; |
|
|
|
// Generate configuration file if not exists |
|
|
|
|
|
|
|
if (!file_exists(sprintf('%s/env.%s.php', __DIR__, $_SERVER['PHP_ENV']))) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
copy( |
|
|
|
|
|
|
|
__DIR__ . '/env.example.php', |
|
|
|
|
|
|
|
sprintf('%s/env.%s.php', __DIR__, $_SERVER['PHP_ENV']) |
|
|
|
|
|
|
|
); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// Autoload |
|
|
|
// Load environment configuration |
|
|
|
require_once __DIR__ . '/../../vendor/autoload.php'; |
|
|
|
require_once sprintf('%s/env.%s.php', __DIR__, $_SERVER['PHP_ENV']); |
|
|
|
|
|
|
|
|
|
|
|
// Local |
|
|
|
// Local internal dependencies |
|
|
|
require_once __DIR__ . '/../library/database.php'; |
|
|
|
require_once __DIR__ . '/../library/database.php'; |
|
|
|
require_once __DIR__ . '/../library/sphinx.php'; |
|
|
|
require_once __DIR__ . '/../library/sphinx.php'; |
|
|
|
require_once __DIR__ . '/../library/scrapeer.php'; |
|
|
|
require_once __DIR__ . '/../library/scrapeer.php'; |
|
|
|
require_once __DIR__ . '/../library/time.php'; |
|
|
|
require_once __DIR__ . '/../library/time.php'; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Vendors autoload |
|
|
|
|
|
|
|
require_once __DIR__ . '/../../vendor/autoload.php'; |