public function executeCommand($cmd, $id) { echo "<p>Executing Command <b>{$cmd}</b></p>"; $anObject = $this; $methodVariable = array($anObject, $cmd); var_dump(is_callable($methodVariable, true, $callable_name)); // bool(true) echo $callable_name, "\n"; // someClass::someMethod $ret = call_user_func($callable_name); if ($ret) { $test = CronJobs::model()->updateLastExecution($id, 'Success'); } else { $test = CronJobs::model()->updateLastExecution($id, 'Error Generate'); } }
public function executeCommand($cmd, $id) { echo "<p>Executing Command <b>{$cmd}</b></p>"; //$this->getController()->redirect(array('/cron/execute/sa/'.$cmd.'/id/'.$id)); $ret = false; if (method_exists($this, $cmd)) { call_user_func($cmd, $a); } if ($ret) { $test = CronJobs::model()->updateLastExecution($id, 'Success'); exit; } else { $test = CronJobs::model()->updateLastExecution($id, 'Error Generate'); } }