Exemplo n.º 1
0
 /**
  * Schedule background expire tasks.
  *
  * This is also used as a callback for job_scheduler integration.
  *
  * @param \Drupal\feeds\FeedInterface $feed
  *   The feed to schedule.
  */
 public function scheduleExpire(FeedInterface $feed)
 {
     if (!$this->jobController) {
         return;
     }
     // Schedule as soon as possible if a batch is active.
     $period = $feed->progressExpiring() === StateInterface::BATCH_COMPLETE ? 3600 : 0;
     $job = array('name' => 'feeds_feed_expire', 'type' => $feed->bundle(), 'id' => $feed->id(), 'period' => $period, 'periodic' => TRUE);
     if ($feed->getImporter()->getProcessor()->expiryTime() == SchedulerInterface::EXPIRE_NEVER) {
         $this->jobController->remove($job);
     } else {
         $this->jobController->set($job);
     }
 }