/** * Add a new cron job to the DB. * * @see CronJob * @param array $paramarray A paramarray of cron job feilds. * @return \Habari\CronJob */ static function add_cron($paramarray) { // Delete any existing job with this same name if ($job = CronTab::get_cronjob($paramarray['name'])) { $job->delete(); } $cron = new CronJob($paramarray); $result = $cron->insert(); //If the new cron should run earlier than the others, rest next_cron to its strat time. $next_cron = DB::get_value('SELECT next_run FROM {crontab} ORDER BY next_run ASC LIMIT 1', array()); if (intval(Options::get('next_cron')) > intval($next_cron)) { Options::set('next_cron', $next_cron); } return $result ? $cron : false; }
/** * Add a new cron job to the DB. * * @see CronJob * @param array $paramarray A paramarray of cron job feilds. */ static function add_cron($paramarray) { $cron = new CronJob($paramarray); $result = $cron->insert(); //If the new cron should run earlier than the others, rest next_cron to its strat time. $next_cron = DB::get_value('SELECT next_run FROM {crontab} ORDER BY next_run ASC LIMIT 1', array()); if (intval(Options::get('next_cron')) > intval($next_cron)) { Options::set('next_cron', $next_cron); } return $result; }