/**
  * Calculates the next build timestamp
  * this is a build once scheduler.
  *
  * @return int
  */
 public function getNextBuildTime(BuildInterface $build)
 {
     if ($build->getLastBuild()->getBuildTime() == null && $build->getStatus() !== BuildInterface::STOPPED) {
         if (!isset($this->_nextBuildTime)) {
             $this->_nextBuildTime = time();
         }
         return $this->_nextBuildTime;
     } else {
         return;
     }
 }
示例#2
0
 public function getNextBuildTime(BuildInterface $build)
 {
     if ($build->getStatus() == BuildInterface::STOPPED) {
         return null;
     }
     //var_dump($build);
     $lastBuild = $build->getLastBuild()->getBuildTime();
     if ($lastBuild == null) {
         $lastBuild = 0;
     }
     //$nextBuild = $this->getLastScheduledRunTime($this->timer . ' test',$lastBuild);
     $nextBuild = $this->getTimeFromCron($lastBuild);
     $build->debug('getNextBuildTime:' . ' lastbuild: ' . date('Y-m-d H:i:s', $lastBuild) . ' nextbuild: ' . date('Y-m-d H:i:s', $nextBuild));
     return $nextBuild;
 }
示例#3
0
 public function getNextBuildTime(BuildInterface $build)
 {
     if ($build->getStatus() == BuildInterface::STOPPED) {
         return null;
     }
     $lastBuild = $build->getLastBuild()->getBuildTime();
     if ($lastBuild !== null) {
         $nextBuild = $this->getInterval() + $lastBuild;
         /**
          * Make sure that we dont rerun every build if the daemon was paused
          */
         //echo time(). ' - ' . $lastBuild .'='.(time()-$lastBuild)."\n";
         if ($nextBuild + $this->getInterval() < time()) {
             $nextBuild = time();
         }
     } else {
         // never ran, schedule for now
         $nextBuild = time();
     }
     $this->log->debug('getNextBuildTime ' . ': lastbuild: ' . date('Y-m-d H:i:s', $lastBuild) . ' nextbuild: ' . date('Y-m-d H:i:s', $nextBuild) . '');
     return $nextBuild;
 }