1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859 |
- <?php
- // 设置页面编码
- //header('Content-Type: text/html; charset=utf-8');
- // 设置时区
- //date_default_timezone_set('Asia/Chongqing');
- // fix for fcgi
- defined('STDIN') OR define('STDIN', fopen('php://stdin', 'r'));
- defined('YII_DEBUG') OR define('YII_DEBUG', TRUE);
- $YII_ENV = '';
- if ($argc AND $argv)
- {
- foreach ($argv AS $k => $v)
- {
- if ($k >= 3)
- {
- if (substr($v, 0, 10) == '--YII_ENV=')
- {
- $YII_ENV = trim(substr($v, 10));
- break;
- }
- }
- }
- }
- if (empty($YII_ENV)){
- $YII_ENV = 'production';
- }
- define('YII_ENV', $YII_ENV);
- // change the following paths if necessary
- $yii = dirname(__FILE__) .'/../../framework/yii.php';
- $config = dirname(__FILE__) .'/../config/console.'. $YII_ENV .'.php';
- if ( ! file_exists($config)) exit('Configuration file does not exist!');
- require_once($yii);
- require_once(dirname(__FILE__) .'/../helper/yii.php');
- if(isset($config))
- {
- $app = Yii::createConsoleApplication($config);
- // $app->commandRunner->addCommands(YII_PATH .'/cli/commands');
- $app->commandRunner->addCommands(dirname(dirname(__FILE__)) .'/commands');
- }
- else
- {
- // $app = Yii::createConsoleApplication(array('basePath' => dirname(__FILE__) .'/cli'));
- $app = Yii::createConsoleApplication(array('basePath' => dirname(dirname(__FILE__)) .'/commands'));
- }
- $env = @getenv('YII_CONSOLE_COMMANDS');
- if( ! empty($env))
- {
- $app->commandRunner->addCommands($env);
- }
- $app->run();
|