/** * Get the cron jobs from Xml file, etc/config.xml * * @return type */ protected function _getJobsFromXml() { $_configFile = App_Main::getModuleDir('etc', 'Cron') . DS . 'config.xml'; if (!file_exists($_configFile)) { App_Main::exception('Core', 'unable ot find the config file for the cron module. Could not continue'); die; } $_xml = simplexml_load_file($_configFile)->crontab; $jobs = array(); foreach ($_xml->jobs->children() as $job) { $cronJob = App_Main::getModel('cron/job'); $cronJob->setJobCode($job->getName()); if ($job->schedule && $job->schedule->cron_expr) { $cronJob->setCronExprString((string) $job->schedule->cron_expr); } $cronJob->setModule((string) $job->run->module); if ($job->run->action) { $cronJob->setAction((string) $job->run->action); } //$cronJob['params'] = (string)$job->run->function; $jobs[] = $cronJob; } return $jobs; }
/** * Get the controller filename * * @param string $realModule * @param string $controller * @return string */ public function getControllerFileName($realModule, $controller) { $parts = explode('_', $realModule); $realModule = implode('_', array_splice($parts, 0, 2)); $file = App_Main::getModuleDir('controller', $realModule); if (count($parts)) { $file .= DS . implode(DS, $parts); } $file .= DS . uc_words($controller, DS) . 'Controller.php'; return $file; }