Beispiel #1
0
 public static function createScheduledJob($timestamp, array $tags = array())
 {
     $cmd = 'Cache clear';
     if (count($tags)) {
         $cmd .= ' ' . implode(' ', $tags);
     }
     $scheduledJobModel = new Model_ScheduledJob();
     return $scheduledJobModel->insert(array('command' => $cmd, 'at' => date('Y-m-d H:i:s', $timestamp)));
 }
Beispiel #2
0
 protected function _runScheduledJobs($serverId, $lastCheckIn)
 {
     // Make sure the model exists
     if (!class_exists('Model_ScheduledJob')) {
         return;
     }
     $scheduledJobModel = new Model_ScheduledJob();
     $jobs = $scheduledJobModel->fetchDue($serverId, $lastCheckIn);
     $this->_executeJobs($jobs, $serverId);
     if (!count($jobs)) {
         Garp_Cli::lineOut('No scheduled jobs to run.');
     }
 }