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(); }
/** * {@inheritodc} */ public function clear(FeedInterface $feed, array &$context) { try { $this->dispatchEvent(FeedsEvents::INIT_CLEAR, new InitEvent($feed)); $this->dispatchEvent(FeedsEvents::CLEAR, new ClearEvent($feed)); } catch (\Exception $exception) { // Do nothing yet. } // Clean up. $context['finished'] = $feed->progressClearing(); if (isset($exception)) { $context['finished'] = StateInterface::BATCH_COMPLETE; } if ($context['finished'] === StateInterface::BATCH_COMPLETE) { $feed->finishClear(); $feed->save(); $feed->unlock(); } else { $feed->saveStates(); } if (isset($exception)) { throw $exception; } }