magento 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. #!/usr/bin/env php
  2. <?php
  3. /**
  4. * Copyright © Magento, Inc. All rights reserved.
  5. * See COPYING.txt for license details.
  6. */
  7. if (PHP_SAPI !== 'cli') {
  8. echo 'bin/magento must be run as a CLI application';
  9. exit(1);
  10. }
  11. if (isset($_SERVER['INTEGRATION_TEST_PARAMS'])) {
  12. parse_str($_SERVER['INTEGRATION_TEST_PARAMS'], $params);
  13. foreach ($params as $paramName => $paramValue) {
  14. $_SERVER[$paramName] = $paramValue;
  15. }
  16. } else {
  17. echo 'Test parameters are required';
  18. exit(1);
  19. }
  20. try {
  21. require $_SERVER['MAGE_DIRS']['base']['path'] . '/app/bootstrap.php';
  22. } catch (\Exception $e) {
  23. echo 'Autoload error: ' . $e->getMessage();
  24. exit(1);
  25. }
  26. try {
  27. $handler = new \Magento\Framework\App\ErrorHandler();
  28. set_error_handler([$handler, 'handler']);
  29. $application = new Magento\Framework\Console\Cli('Magento CLI');
  30. $application->run();
  31. } catch (\Exception $e) {
  32. while ($e) {
  33. echo $e->getMessage();
  34. echo $e->getTraceAsString();
  35. echo "\n\n";
  36. $e = $e->getPrevious();
  37. }
  38. exit(Cli::RETURN_FAILURE);
  39. }