本文整理汇总了PHP中CConsoleCommand::run方法的典型用法代码示例。如果您正苦于以下问题:PHP CConsoleCommand::run方法的具体用法?PHP CConsoleCommand::run怎么用?PHP CConsoleCommand::run使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CConsoleCommand
的用法示例。
在下文中一共展示了CConsoleCommand::run方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: run
public function run($args)
{
\Yii::getLogger()->autoFlush = 1;
\Yii::getLogger()->detachEventHandler('onFlush', [\Yii::app()->log, 'collectLogs']);
\Yii::getLogger()->attachEventHandler('onFlush', [$this, 'processLogs']);
parent::run($args);
}
示例2: run
public function run($args)
{
if (in_array('verbose', $args)) {
$this->outputLog = true;
}
parent::run($args);
}
示例3: run
/**
* Deciding if we are running the command locally or on Iron Workers
* @see CConsoleCommand::run()
* @param $args array
* @return If run locally the exit code. If run as IronWorker the ironWorker id.
*/
public function run($args)
{
//Store the parameters passed to the function, will be used to pass on to the iron workers
$this->yiicParams = $args;
//Add in the command name
array_unshift($this->yiicParams, $this->getName());
//Add in the entry script name
array_unshift($this->yiicParams, "./" . $this->getCommandRunner()->getScriptName());
CVarDumper::dump($this->yiicParams, 100, false);
if ($this->isIronWorker()) {
$this->ironWorker = true;
//Kick the command off to Iron Workers
$resId = $this->runAsIronWorker();
echo "Task " . $resId . " pushed to Iron Worker!\n";
//When run as an iron worker we return the IronWorker id
return $resId;
} else {
parent::run($args);
}
}
示例4: run
/**
* Converts unnamed arguments to named.
* Uses current action params as names.
*/
public function run($args)
{
list($action, $options, $args) = $this->resolveRequest($args);
$methodName = 'action' . $action;
if (!preg_match('/^\\w+$/', $action) || !method_exists($this, $methodName)) {
$this->usageError("Unknown action: " . $action);
}
$method = new ReflectionMethod($this, $methodName);
foreach ($method->getParameters() as $i => $param) {
if (!empty($args)) {
$options[$param->getName()] = array_shift($args);
}
}
$args2 = array($action);
foreach ($options as $key => $value) {
$args2[] = '--' . $key . ($value !== true ? '=' . $value : '');
}
$args2 = array_merge($args2, $args);
return parent::run($args2);
}
示例5: run
public function run($args)
{
parent::run($args);
}