Browse Source

Renamed yiic to yii.

Added console command support to the bootstrap app.
tags/2.0.0-beta
Qiang Xue 12 years ago
parent
commit
c10fe193d2
  1. 29
      apps/bootstrap/protected/commands/HelloController.php
  2. 26
      apps/bootstrap/protected/config/console.php
  3. 6
      apps/bootstrap/protected/config/main.php
  4. 5
      apps/bootstrap/protected/config/params.php
  5. 23
      apps/bootstrap/protected/yii
  6. 2
      apps/bootstrap/protected/yii.bat
  7. 1
      yii/console/controllers/CacheController.php
  8. 5
      yii/yii
  9. 22
      yii/yii.bat
  10. 13
      yii/yiic

29
apps/bootstrap/protected/commands/HelloController.php

@ -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;
}
}

26
apps/bootstrap/protected/config/console.php

@ -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'),
);

6
apps/bootstrap/protected/config/main.php

@ -1,7 +1,7 @@
<?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'),
);

5
apps/bootstrap/protected/config/params.php

@ -0,0 +1,5 @@
<?php
return array(
'adminEmail' => 'admin@example.com',
);

23
apps/bootstrap/protected/yii

@ -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();

2
yii/yiic.bat → apps/bootstrap/protected/yii.bat

@ -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

1
yii/console/controllers/CacheController.php

@ -19,6 +19,7 @@ use yii\caching\Cache;
*/
class CacheController extends Controller
{
public function actionIndex()
{
$this->forward('help/index', array('-args' => array('cache/flush')));

5
yii/yiic.php → yii/yii

@ -1,3 +1,4 @@
#!/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();

22
yii/yii.bat

@ -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 &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

13
yii/yiic

@ -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…
Cancel
Save