Beispiel #1
0
 public function run()
 {
     $record = $this->repository->find($this->name);
     $midnight = new DateTime('midnight');
     $now = new DateTime();
     $expectedTime = new DateTime($this->hour);
     if ($record->lastRun !== null && $record->lastRun >= $midnight || $now < $expectedTime) {
         return false;
     }
     $this->repository->updateTime($this->name, new DateTime());
     return $this->job->run();
 }
Beispiel #2
0
 public function run()
 {
     $record = $this->repository->find($this->name);
     if ($record->lastRun !== null) {
         $timeLimit = new DateTime($record->lastRun->format('Y-m-d H:i:s') . ' + ' . $this->interval);
         if ($timeLimit > new DateTime()) {
             return false;
         }
     }
     $this->repository->updateTime($this->name, new DateTime());
     return $this->job->run();
 }
Beispiel #3
0
 public function run()
 {
     $record = $this->repository->find($this->name);
     if ($record->getLastRun() !== null) {
         $midnight = $this->dateTimeProvider->getTime('midnight');
         $midnightOfLastRun = $this->dateTimeProvider->getTime($record->getLastRun()->format('Y-m-d'));
         if ($midnight == $midnightOfLastRun) {
             return false;
         }
     }
     $this->repository->updateTime($this->name, new DateTime());
     return $this->job->run();
 }