Commit c10fe193 by Qiang Xue

Renamed yiic to yii.

Added console command support to the bootstrap app.
parent 71c60b63
<?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;
}
}
\ No newline at end of file
<?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'),
);
<?php
return array(
'id' => 'hello',
'id' => 'bootstrap',
'basePath' => dirname(__DIR__),
'preload' => array('log'),
'modules' => array(
......@@ -33,7 +33,5 @@ return array(
),
),
),
'params' => array(
'adminEmail' => 'admin@example.com',
),
'params' => require(__DIR__ . '/params.php'),
);
<?php
return array(
'adminEmail' => 'admin@example.com',
);
\ No newline at end of file
#!/usr/bin/env php
<?php
/**
* Yii command line script for Unix/Linux.
*
* This is the bootstrap script for running yiic on Unix/Linux.
* Yii console bootstrap file.
*
* @link http://www.yiiframework.com/
* @copyright Copyright (c) 2008 Yii Software LLC
* @license http://www.yiiframework.com/license/
*/
require_once(__DIR__ . '/yiic.php');
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();
\ No newline at end of file
......@@ -17,6 +17,6 @@ set YII_PATH=%~dp0
if "%PHP_COMMAND%" == "" set PHP_COMMAND=php.exe
"%PHP_COMMAND%" "%YII_PATH%yiic" %*
"%PHP_COMMAND%" "%YII_PATH%yii" %*
@endlocal
\ No newline at end of file
......@@ -19,6 +19,7 @@ use yii\caching\Cache;
*/
class CacheController extends Controller
{
public function actionIndex()
{
$this->forward('help/index', array('-args' => array('cache/flush')));
......
#!/usr/bin/env php
<?php
/**
* Yii console bootstrap file.
......@@ -15,8 +16,8 @@ defined('STDIN') or define('STDIN', fopen('php://stdin', 'r'));
require(__DIR__ . '/Yii.php');
$application = new yii\console\Application(array(
'id' => 'yiic',
'id' => 'yii-console',
'basePath' => __DIR__ . '/console',
'controllerPath' => '@yii/console/controllers',
));
$application->run();
$application->run();
\ No newline at end of file
@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 &copy; 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
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment