Qiang Xue
12 years ago
12 changed files with 153 additions and 61 deletions
@ -0,0 +1,29 @@
|
||||
<?php |
||||
/** |
||||
* @link http://www.yiiframework.com/ |
||||
* @copyright Copyright (c) 2008 Yii Software LLC |
||||
* @license http://www.yiiframework.com/license/ |
||||
*/ |
||||
|
||||
namespace app\commands; |
||||
use yii\console\Controller; |
||||
|
||||
/** |
||||
* This command echos what the first argument that you have entered. |
||||
* |
||||
* This command is provided as an example for you to learn how to create console commands. |
||||
* |
||||
* @author Qiang Xue <qiang.xue@gmail.com> |
||||
* @since 2.0 |
||||
*/ |
||||
class HelloController extends Controller |
||||
{ |
||||
/** |
||||
* This command echos what you have entered as the message. |
||||
* @param string $message the message to be echoed. |
||||
*/ |
||||
public function actionIndex($message = 'hello world') |
||||
{ |
||||
echo $message; |
||||
} |
||||
} |
@ -0,0 +1,26 @@
|
||||
<?php |
||||
|
||||
return array( |
||||
'id' => 'bootstrap-console', |
||||
'basePath' => dirname(__DIR__), |
||||
'preload' => array('log'), |
||||
'controllerPath' => dirname(__DIR__) . '/commands', |
||||
'controllerNamespace' => 'app\commands', |
||||
'modules' => array( |
||||
), |
||||
'components' => array( |
||||
'cache' => array( |
||||
'class' => 'yii\caching\FileCache', |
||||
), |
||||
'log' => array( |
||||
'class' => 'yii\logging\Router', |
||||
'targets' => array( |
||||
array( |
||||
'class' => 'yii\logging\FileTarget', |
||||
'levels' => array('error', 'warning'), |
||||
), |
||||
), |
||||
), |
||||
), |
||||
'params' => require(__DIR__ . '/params.php'), |
||||
); |
@ -0,0 +1,5 @@
|
||||
<?php |
||||
|
||||
return array( |
||||
'adminEmail' => 'admin@example.com', |
||||
); |
@ -0,0 +1,23 @@
|
||||
#!/usr/bin/env php |
||||
<?php |
||||
/** |
||||
* Yii console bootstrap file. |
||||
* |
||||
* @link http://www.yiiframework.com/ |
||||
* @copyright Copyright (c) 2008 Yii Software LLC |
||||
* @license http://www.yiiframework.com/license/ |
||||
*/ |
||||
|
||||
defined('YII_DEBUG') or define('YII_DEBUG', true); |
||||
|
||||
// fcgi doesn't have STDIN defined by default |
||||
defined('STDIN') or define('STDIN', fopen('php://stdin', 'r')); |
||||
|
||||
$frameworkPath = __DIR__ . '/../../../yii'; |
||||
|
||||
require($frameworkPath . '/Yii.php'); |
||||
|
||||
$config = require(__DIR__ . '/config/console.php'); |
||||
|
||||
$application = new yii\console\Application($config); |
||||
$application->run(); |
@ -0,0 +1,22 @@
|
||||
@echo off |
||||
|
||||
rem ------------------------------------------------------------- |
||||
rem Yii command line script for Windows. |
||||
rem |
||||
rem This is the bootstrap script for running yiic on Windows. |
||||
rem |
||||
rem @author Qiang Xue <qiang.xue@gmail.com> |
||||
rem @link http://www.yiiframework.com/ |
||||
rem @copyright Copyright © 2012 Yii Software LLC |
||||
rem @license http://www.yiiframework.com/license/ |
||||
rem ------------------------------------------------------------- |
||||
|
||||
@setlocal |
||||
|
||||
set YII_PATH=%~dp0 |
||||
|
||||
if "%PHP_COMMAND%" == "" set PHP_COMMAND=php.exe |
||||
|
||||
"%PHP_COMMAND%" "%YII_PATH%yii" %* |
||||
|
||||
@endlocal |
@ -1,13 +0,0 @@
|
||||
#!/usr/bin/env php |
||||
<?php |
||||
/** |
||||
* Yii command line script for Unix/Linux. |
||||
* |
||||
* This is the bootstrap script for running yiic on Unix/Linux. |
||||
* |
||||
* @link http://www.yiiframework.com/ |
||||
* @copyright Copyright (c) 2008 Yii Software LLC |
||||
* @license http://www.yiiframework.com/license/ |
||||
*/ |
||||
|
||||
require_once(__DIR__ . '/yiic.php'); |
Loading…
Reference in new issue