You are here

public function FeedExpireHandler::postExpire in Feeds 8.3

Handles clean up tasks after expiring items is done.

Parameters

\Drupal\feeds\FeedInterface $feed: The feed for which items got expired.

File

src/FeedExpireHandler.php, line 102

Class

FeedExpireHandler
Expires the items of a feed.

Namespace

Drupal\feeds

Code

public function postExpire(FeedInterface $feed) {
  $state = $feed
    ->getState(StateInterface::EXPIRE);
  if ($state->total) {
    $this
      ->messenger()
      ->addStatus($this
      ->t('Expired @count items.', [
      '@count' => $state->total,
    ]));
  }
  $feed
    ->clearStates();
  $feed
    ->save();
  $feed
    ->unlock();
}