Exemple #1
0
 /**
  * run the job, then remove it from the jobList
  *
  * @param JobList $jobList
  * @param ILogger $logger
  */
 public function execute($jobList, ILogger $logger = null)
 {
     if ($this->shouldRun($this->argument)) {
         parent::execute($jobList, $logger);
         $jobList->remove($this, $this->argument);
         if ($this->retainJob) {
             $this->reAddJob($jobList, $this->argument);
         }
     }
 }
Exemple #2
0
 /**
  * set the lastRun of $job to now
  *
  * @param Job $job
  */
 public function setLastRun($job)
 {
     $query = $this->conn->prepare('UPDATE `*PREFIX*jobs` SET `last_run` = ? WHERE `id` = ?');
     $query->execute(array(time(), $job->getId()));
 }
Exemple #3
0
 /**
  * run the job if
  *
  * @param JobList $jobList
  * @param ILogger $logger
  */
 public function execute($jobList, ILogger $logger = null)
 {
     if (time() - $this->lastRun > $this->interval) {
         parent::execute($jobList, $logger);
     }
 }
 /**
  * call execute() method of parent
  *
  * @param JobList $jobList
  * @param ILogger $logger
  */
 protected function parentExecute($jobList, $logger)
 {
     parent::execute($jobList, $logger);
 }
Exemple #5
0
 /**
  * set the lastRun of $job to now
  *
  * @param \OC\BackgroundJob\Job $job
  */
 public function setLastRun($job)
 {
     $job->setLastRun(time());
 }
Exemple #6
0
 /**
  * run the job, then remove it from the joblist
  *
  * @param JobList $jobList
  * @param ILogger $logger
  */
 public function execute($jobList, ILogger $logger = null)
 {
     $jobList->remove($this, $this->argument);
     parent::execute($jobList, $logger);
 }
 /**
  * Run the job if the scheduling conditions are met
  *
  * @param \OCP\BackgroundJob\IJobList $jobList        	
  * @param \OC\Log $logger        	
  */
 public function execute($jobList, $logger = null)
 {
     $firstRunAtHour = $this->getConfigService()->getScheduleTimeUTC();
     if ($this->getLastRun()) {
         $lastRun = new \DateTime();
         $lastRun->setTimestamp($this->getLastRun());
         $shouldExecute = $this->getScheduleService()->isToBeExecutedNow($firstRunAtHour, $lastRun);
     } else {
         $shouldExecute = $this->getScheduleService()->isToBeExecutedNow($firstRunAtHour);
     }
     if ($shouldExecute) {
         parent::execute($jobList, $logger);
     }
 }