public function UltimateCronJob::invoke in Ultimate Cron 7.2
Invoke the jobs callback.
File
- ./
ultimate_cron.job.inc, line 305 - Job class for Ultimate Cron.
Class
- UltimateCronJob
- Class for handling cron jobs.
Code
public function invoke() {
try {
UltimateCronPlugin::hook_cron_pre_invoke($this);
module_invoke_all('cron_pre_invoke', $this);
switch ($this->hook['api_version']) {
case 'ultimate_cron-1':
// error_log("$this->name : INVOKE 1.x");
if (is_callable($this->hook['callback'])) {
$result = call_user_func_array($this->hook['callback'], array(
$this->name,
$this->hook,
));
break;
}
else {
$result = module_invoke($this->hook['module'], 'cronapi', 'execute', $this->name, $this->hook);
break;
}
case 'ultimate_cron-2':
// error_log("$this->name : INVOKE 2.x");
if (isset($this->hook['file'])) {
require_once $this->hook['file path'] . '/' . $this->hook['file'];
}
$arguments = array(
$this->hook['callback arguments'],
);
if ($this->hook['pass job argument']) {
array_unshift($arguments, $this);
}
$result = call_user_func_array($this->hook['callback'], $arguments);
break;
case 'elysia_cron-2':
if (isset($this->hook['file'])) {
require_once $this->hook['file path'] . '/' . $this->hook['file'];
}
// error_log("$this->name : INVOKE ELYSIA CRON 2.x");
if (is_callable($this->hook['callback'])) {
$arguments = !empty($this->hook['arguments']) ? $this->hook['arguments'] : array();
$result = call_user_func_array($this->hook['callback'], $arguments);
break;
}
else {
$result = module_invoke($this->hook['module'], 'cronapi', 'execute', $this->name);
break;
}
default:
// error_log("$this->name : COULD NOT INVOKE JOB");
throw new Exception(t('Could not invoke cron job @name. Wrong API version (@api_version)', array(
'@name' => $this->name,
'@api_version' => $this->hook['api_version'],
)));
}
} catch (Throwable $e) {
UltimateCronPlugin::hook_cron_post_invoke($this);
module_invoke_all('cron_post_invoke', $this);
throw $e;
} catch (Exception $e) {
UltimateCronPlugin::hook_cron_post_invoke($this);
module_invoke_all('cron_post_invoke', $this);
throw $e;
}
UltimateCronPlugin::hook_cron_post_invoke($this);
module_invoke_all('cron_post_invoke', $this);
return $result;
}