Class CConsoleApplication
CConsoleApplication represents a console application.
CConsoleApplication extendsCApplication
by providing functionalities
specific to console requests. In particular, it deals with console requests
through a command-based approach:
- A console application consists of one or several possible user commands;
- Each user command is implemented as a class extending
CConsoleCommand
; - User specifies which command to run on the command line;
- The command processes the user request with the specified parameters.
The command classes reside in the directory getCommandPath commandPath. The name of the class follows the pattern: <command-name>Command, and its file name is the same as the class name. For example, the 'ShellCommand' class defines a 'shell' command and the class file name is 'ShellCommand.php'.
To run the console application, enter the following on the command line:
php path/to/entry_script.php <command name> [param 1] [param 2] ...
You may use the following to see help instructions about a command:
php path/to/entry_script.php help <command name>
- CComponent
- CModule
- CApplication
- CConsoleApplication
Copyright: 2008-2013 Yii Software LLC
License: http://www.yiiframework.com/license/
Author: Qiang Xue <qiang.xue@gmail.com>
Since: 1.0
Located at x2engine/framework/console/CConsoleApplication.php
protected
|
|
public
|
#
processRequest( )
Processes the user request. This method uses a console command runner to handle the particular user command. Since version 1.1.11 this method will exit application with an exit code if one is returned by the user command. |
protected
|
|
public
|
#
displayError( integer $code, string $message, string $file, string $line )
Displays the captured PHP error. This method displays the error in console mode when there is no active error handler. |
public
|
#
displayException(
Displays the uncaught PHP exception. This method displays the exception in console mode when there is no active error handler. |
public
string
|
|
public
|
|
public
|
|
public
|
#
getCommand( )
Returns the currently running command. This is shortcut method for |
public
|
#
setCommand(
This is shortcut method for |
public
array
|
$commandMap | array() |
#
mapping from command name to command configurations. Each command configuration can be either a string or an array. If the former, the string should be the file path of the command class. If the latter, the array must contain a 'class' element which specifies the command's class name or YiiBase::getPathOfAlias class path alias. The rest name-value pairs in the array are used to initialize the corresponding command properties. For example, array( 'email'=>array( 'class'=>'path.to.Mailer', 'interval'=>3600, ), 'log'=>'path/to/LoggerCommand.php', ) |
$charset,
$localeClass,
$name,
$sourceLanguage
|
$behaviors,
$preload
|
public
string
|
$commandPath |
#
The directory that contains the command classes. Defaults to 'protected/commands'. |
public
|
$commandRunner |
#
The command runner. |
public
|
$command |
#
The currently active command. |
$basePath,
$baseUrl,
$cache,
$controller,
$coreMessages,
$dateFormatter,
$db,
$errorHandler,
$extensionPath,
$homeUrl,
$id,
$language,
$locale,
$localeDataPath,
$messages,
$numberFormatter,
$request,
$runtimePath,
$securityManager,
$statePersister,
$timeZone,
$urlManager
|
$aliases,
$components,
$import,
$modulePath,
$modules,
$params,
$parentModule
|