console 891 B

123456789101112131415161718192021222324252627282930313233
  1. #!/usr/bin/env php
  2. <?php
  3. use Chamilo\Kernel;
  4. use Symfony\Bundle\FrameworkBundle\Console\Application;
  5. use Symfony\Component\Dotenv\Dotenv;
  6. use Symfony\Component\Console\Input\ArgvInput;
  7. use Symfony\Component\Debug\Debug;
  8. umask(0000);
  9. set_time_limit(0);
  10. require __DIR__.'/../vendor/autoload.php';
  11. if (!class_exists(Application::class)) {
  12. throw new \RuntimeException('You need to add "symfony/framework-bundle" as a Composer dependency.');
  13. }
  14. if (!getenv('APP_ENV')) {
  15. (new Dotenv())->load(__DIR__.'/../.env');
  16. }
  17. $input = new ArgvInput();
  18. $env = $input->getParameterOption(['--env', '-e'], getenv('APP_ENV') ?: 'dev');
  19. $debug = getenv('APP_DEBUG') !== '0' && !$input->hasParameterOption(['--no-debug', '']);
  20. if ($debug && class_exists(Debug::class)) {
  21. Debug::enable();
  22. }
  23. $kernel = new Kernel($env, $debug);
  24. $application = new Application($kernel);
  25. $application->run($input);