/**
* Execute the action
* We will build the classname, require the class and call the execute method.
*/
protected function execute()
{
if (extension_loaded('newrelic')) {
newrelic_background_job();
}
$this->loadConfig();
// build action-class-name
$actionClass = 'Backend\\Modules\\' . $this->getModule() . '\\Cronjobs\\' . $this->getAction();
if ($this->getModule() == 'Core') {
$actionClass = 'Backend\\Core\\Cronjobs\\' . $this->getAction();
}
// validate if class exists (aka has correct name)
if (!class_exists($actionClass)) {
// set correct headers
\SpoonHTTP::setHeadersByCode(500);
// throw exception
throw new Exception('The cronjobfile is present, but the classname should be: ' . $actionClass . '.');
}
// create action-object
$this->cronjob = new $actionClass($this->getKernel());
$this->cronjob->setModule($this->getModule());
$this->cronjob->setAction($this->getAction());
if (extension_loaded('newrelic')) {
newrelic_name_transaction('cronjob::' . $this->getModule() . '::' . $this->getAction());
}
}