cli.php 904 B

123456789101112131415161718192021222324252627282930313233343536
  1. <?php
  2. /*
  3. * This file is part of the symfony package.
  4. * (c) Fabien Potencier <fabien.potencier@symfony-project.com>
  5. *
  6. * For the full copyright and license information, please view the LICENSE
  7. * file that was distributed with this source code.
  8. */
  9. require_once(dirname(__FILE__).'/../autoload/sfCoreAutoload.class.php');
  10. sfCoreAutoload::register();
  11. try
  12. {
  13. $dispatcher = new sfEventDispatcher();
  14. $logger = new sfCommandLogger($dispatcher);
  15. $application = new sfSymfonyCommandApplication($dispatcher, new sfAnsiColorFormatter(), array('symfony_lib_dir' => realpath(dirname(__FILE__).'/..')));
  16. $statusCode = $application->run();
  17. }
  18. catch (Exception $e)
  19. {
  20. if (!isset($application))
  21. {
  22. throw $e;
  23. }
  24. $application->renderException($e);
  25. $statusCode = $e->getCode();
  26. exit(is_numeric($statusCode) && $statusCode ? $statusCode : 1);
  27. }
  28. exit(is_numeric($statusCode) ? $statusCode : 0);