public function testcheckPendingJobs() { $scheduler = new Scheduler(); //execute the method and test if it works and does not throws an exception. try { $scheduler->checkPendingJobs(new SugarJobQueue()); $this->assertTrue(true); } catch (Exception $e) { $this->fail(); } }
write_array_to_file('timestamp', array(strtotime(date('H:i'))), $cachePath . '/' . $pid); require_once $cachePath . '/' . $pid; } else { $GLOBALS['log']->fatal('Scheduler cannot write PID file. Please check permissions on ' . $cachePath); } } else { if (is_writable($cachePath . '/' . $pid)) { require_once $cachePath . '/' . $pid; } else { $GLOBALS['log']->fatal('Scheduler cannot read the PID file. Please check permissions on ' . $cachePath); } } //// END PREP FOR SCHEDULER PID /////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////// //// EXECUTE IF VALID TIME (NOT DDOS) if ($timestamp[0] < strtotime(date('H:i'))) { if (is_writable($cachePath . '/' . $pid)) { write_array_to_file('timestamp', array(strtotime(date('H:i'))), $cachePath . '/' . $pid); require 'modules/Schedulers/Scheduler.php'; $s = new Scheduler(); $s->flushDeadJobs(); $s->checkPendingJobs(); } else { $GLOBALS['log']->fatal('Scheduler cannot write PID file. Please check permissions on ' . $cachePath); } } else { $GLOBALS['log']->fatal('If you see a whole string of these, there is a chance someone is attacking your system.'); } $exit_on_cleanup = true; sugar_cleanup($exit_on_cleanup);
/** * Run schedulers to instantiate scheduled jobs */ public function runSchedulers() { $sched = new Scheduler(); $sched->checkPendingJobs($this); }