Exemplo n.º 1
0
 /**
  * {@inheritodc}
  */
 public function startBatchClear(FeedInterface $feed)
 {
     $feed->lock();
     $feed->clearStates();
     $batch = ['title' => $this->t('Deleting items from: %title', ['%title' => $feed->label()]), 'init_message' => $this->t('Deleting items from: %title', ['%title' => $feed->label()]), 'operations' => [[[$this, 'clear'], [$feed]]], 'progress_message' => $this->t('Deleting items from: %title', ['%title' => $feed->label()]), 'error_message' => $this->t('An error occored while clearing %title.', ['%title' => $feed->label()])];
     batch_set($batch);
 }
Exemplo n.º 2
0
 public function postExpire(FeedInterface $feed)
 {
     $state = $feed->getState(StateInterface::EXPIRE);
     if ($state->total) {
         drupal_set_message(t('Expired @count items.', ['@count' => $state->total]));
     }
     $feed->clearStates();
     $feed->save();
     $feed->unlock();
 }
Exemplo n.º 3
0
 /**
  * {@inheritodc}
  */
 public function startBatchImport(FeedInterface $feed)
 {
     try {
         $feed->lock();
     } catch (LockException $e) {
         drupal_set_message(t('The feed became locked before the import could begin.'), 'warning');
         return;
     }
     $feed->clearStates();
     $this->startBatchFetch($feed);
 }