You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

43 lines
1.1KB

  1. #!/usr/bin/env php
  2. <?php
  3. /**
  4. * Yii console bootstrap file.
  5. *
  6. * @link http://www.yiiframework.com/
  7. * @copyright Copyright (c) 2008 Yii Software LLC
  8. * @license http://www.yiiframework.com/license/
  9. */
  10. defined('YII_DEBUG') or define('YII_DEBUG', true);
  11. // fcgi doesn't have STDIN and STDOUT defined by default
  12. defined('STDIN') or define('STDIN', fopen('php://stdin', 'r'));
  13. defined('STDOUT') or define('STDOUT', fopen('php://stdout', 'w'));
  14. $composerAutoload = [
  15. __DIR__ . '/../vendor/autoload.php', // in yii2-dev repo
  16. __DIR__ . '/../../autoload.php', // installed as a composer binary
  17. ];
  18. $vendorPath = null;
  19. foreach ($composerAutoload as $autoload) {
  20. if (file_exists($autoload)) {
  21. require($autoload);
  22. $vendorPath = dirname($autoload);
  23. break;
  24. }
  25. }
  26. require(__DIR__ . '/Yii.php');
  27. $application = new yii\console\Application([
  28. 'id' => 'yii-console',
  29. 'basePath' => __DIR__ . '/console',
  30. 'controllerNamespace' => 'yii\console\controllers',
  31. ]);
  32. if (isset($vendorPath)) {
  33. $application->setVendorPath($vendorPath);
  34. }
  35. $exitCode = $application->run();
  36. exit($exitCode);