Esempio n. 1
0
 /**
  * Helper function: updates 'LastExecution' value in database for this job.
  */
 private function updateLastExecutionTime()
 {
     // Use php time (in case it differs from time on the db server)
     $now = date('Y-m-d H:i:s', time());
     $dao = new JobDao();
     $this->job->setLastExecution($now);
     $dao->save($this->job);
 }
Esempio n. 2
0
 /**
  * Return all jobs that should be run right now.
  * 
  * @return
  * 			NULL if there are no jobs scheduled to be executed now.
  * 			Array of Job objects if there are Jobs ready to be executed.
  */
 public function find()
 {
     $dao = new JobDao();
     // Use php time (in case it differs from time on the db server)
     $now = date('Y-m-d H:i:s', time());
     $tasks = $dao->getWithSql("SELECT * FROM Job WHERE '{$now}' > ( `LastExecution` + INTERVAL `Delay` SECOND )", false);
     return $tasks;
 }