]> Raphaƫl G. Git Repositories - airlibre/blob - bin/console
Add console and index.php to fix the umask
[airlibre] / bin / console
1 #!/usr/bin/env php
2 <?php
3
4 use App\Kernel;
5 use Symfony\Bundle\FrameworkBundle\Console\Application;
6 use Symfony\Component\Console\Input\ArgvInput;
7 use Symfony\Component\Debug\Debug;
8
9 if (false === in_array(\PHP_SAPI, ['cli', 'phpdbg', 'embed'], true)) {
10 echo 'Warning: The console should be invoked via the CLI version of PHP, not the '.\PHP_SAPI.' SAPI'.\PHP_EOL;
11 }
12
13 set_time_limit(0);
14
15 require dirname(__DIR__).'/vendor/autoload.php';
16
17 if (!class_exists(Application::class)) {
18 throw new RuntimeException('You need to add "symfony/framework-bundle" as a Composer dependency.');
19 }
20
21 $input = new ArgvInput();
22 if (null !== $env = $input->getParameterOption(['--env', '-e'], null, true)) {
23 putenv('APP_ENV='.$_SERVER['APP_ENV'] = $_ENV['APP_ENV'] = $env);
24 }
25
26 if ($input->hasParameterOption('--no-debug', true)) {
27 putenv('APP_DEBUG='.$_SERVER['APP_DEBUG'] = $_ENV['APP_DEBUG'] = '0');
28 }
29
30 require dirname(__DIR__).'/config/bootstrap.php';
31
32 if ($_SERVER['APP_DEBUG']) {
33 umask(0002);
34
35 if (class_exists(Debug::class)) {
36 Debug::enable();
37 }
38 }
39
40 $kernel = new Kernel($_SERVER['APP_ENV'], (bool) $_SERVER['APP_DEBUG']);
41 $application = new Application($kernel);
42 $application->run($input);