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); }
public function run($args) { if (in_array('verbose', $args)) { $this->outputLog = true; } parent::run($args); }
/** * 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); } }
/** * 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); }
public function run($args) { parent::run($args); }