CConsoleCommandRunner
| Package |
system.console |
| Inheritance |
class CConsoleCommandRunner »
CComponent |
| Since |
1.0 |
| Version |
$Id: CConsoleCommandRunner.php 1832 2010-02-20 03:22:45Z qiang.xue $ |
CConsoleCommandRunner manages commands and executes the requested command.
Public Properties
Hide inherited properties
| Property | Type | Description | Defined By |
| commands |
array |
list of all available commands (command name=>command configuration). |
CConsoleCommandRunner |
| scriptName |
string |
the entry script name |
CConsoleCommandRunner |
Property Details
commands
public array $commands;
list of all available commands (command name=>command configuration).
Each command configuration can be either a string or an array.
If the former, the string should be the class name or
class path alias of the command.
If the latter, the array must contain a 'class' element which specifies
the command's class name or 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',
)
the entry script name
Method Details
addCommands()
|
public void addCommands(string $path)
|
| $path |
string |
the alias of the directory containing the command class files. |
Adds commands from the specified command path.
If a command already exists, the new one will be ignored.
createCommand()
|
|
| $name |
string |
command name (case-insensitive) |
| {return} |
CConsoleCommand |
the command object. Null if the name is invalid. |
findCommands()
|
public array findCommands(string $path)
|
| $path |
string |
the directory containing the command class files. |
| {return} |
array |
list of commands (command name=>command class file) |
Searches for commands under the specified directory.
|
public string getScriptName()
|
| {return} |
string |
the entry script name |
|
public void run(array $args)
|
| $args |
array |
list of user supplied parameters (including the entry script name and the command name). |
Executes the requested command.