console 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. #!/usr/bin/env php
  2. <?php
  3. use Chamilo\Kernel;
  4. use Symfony\Bundle\FrameworkBundle\Console\Application;
  5. use Symfony\Component\Console\Input\ArgvInput;
  6. use Symfony\Component\Debug\Debug;
  7. set_time_limit(0);
  8. require dirname(__DIR__).'/vendor/autoload.php';
  9. if (!class_exists(Application::class)) {
  10. throw new RuntimeException('You need to add "symfony/framework-bundle" as a Composer dependency.');
  11. }
  12. $input = new ArgvInput();
  13. if (null !== $_ENV['APP_ENV'] = $input->getParameterOption(['--env', '-e'], null, true)) {
  14. putenv('APP_ENV='.$_ENV['APP_ENV']);
  15. // force loading .env files when --env is defined
  16. $_SERVER['APP_ENV'] = null;
  17. }
  18. if ($input->hasParameterOption('--no-debug', true)) {
  19. putenv('APP_DEBUG='.$_SERVER['APP_DEBUG'] = $_ENV['APP_DEBUG'] = '0');
  20. }
  21. require dirname(__DIR__).'/config/bootstrap.php';
  22. if ($_SERVER['APP_DEBUG']) {
  23. umask(0000);
  24. if (class_exists(Debug::class)) {
  25. Debug::enable();
  26. }
  27. }
  28. $kernel = new Kernel($_SERVER['APP_ENV'], (bool) $_SERVER['APP_DEBUG']);
  29. $application = new Application($kernel);
  30. $application->run($input);