0
0
Fork 0
mirror of https://github.com/kevinpapst/kimai2.git synced 2025-03-20 15:43:01 +00:00
kevinpapst_kimai2/bin/console

41 lines
1.2 KiB
Text
Raw Normal View History

2016-10-20 20:10:41 +00:00
#!/usr/bin/env php
<?php
set_time_limit(0);
if (!file_exists(__DIR__.'/../vendor/autoload.php')) {
echo 'Warning: You need to run "composer install" before you can use the console.' . \PHP_EOL;
die(1);
}
require __DIR__.'/../vendor/autoload.php';
2018-01-12 19:39:07 +00:00
use App\Kernel;
2016-10-20 20:10:41 +00:00
use Symfony\Bundle\FrameworkBundle\Console\Application;
use Symfony\Component\Console\Input\ArgvInput;
2020-02-04 14:29:26 +00:00
use Symfony\Component\ErrorHandler\Debug;
2018-01-12 19:39:07 +00:00
use Symfony\Component\Dotenv\Dotenv;
2016-10-20 20:10:41 +00:00
2018-01-12 19:39:07 +00:00
if (!isset($_SERVER['APP_ENV'])) {
if (!class_exists(Dotenv::class)) {
throw new \RuntimeException('APP_ENV environment variable is not defined. You need to define environment variables or change the variables in your .env file.');
2018-01-12 19:39:07 +00:00
}
(new Dotenv(true))->load(__DIR__.'/../.env');
2018-01-12 19:39:07 +00:00
}
2016-10-20 20:10:41 +00:00
$input = new ArgvInput();
2018-01-12 19:39:07 +00:00
$env = $input->getParameterOption(['--env', '-e'], $_SERVER['APP_ENV'] ?? 'dev');
$debug = ($_SERVER['APP_DEBUG'] ?? ('prod' !== $env)) && !$input->hasParameterOption(['--no-debug', '']);
2016-10-20 20:10:41 +00:00
if ($debug) {
2018-01-12 19:39:07 +00:00
umask(0000);
if (class_exists(Debug::class)) {
Debug::enable();
}
2016-10-20 20:10:41 +00:00
}
2018-01-12 19:39:07 +00:00
$kernel = new Kernel($env, $debug);
2016-10-20 20:10:41 +00:00
$application = new Application($kernel);
$application->run($input);