Implements \Drupal\aggregator\Plugin\ProcessorInterface::postProcess().
Expires items from a feed depending on expiration settings.
Overrides ProcessorInterface::postProcess
public function postProcess(Feed $feed) {
$aggregator_clear = config('aggregator.settings')
->get('items.expire');
if ($aggregator_clear != AGGREGATOR_CLEAR_NEVER) {
// Remove all items that are older than flush item timer.
$age = REQUEST_TIME - $aggregator_clear;
$iids = Database::getConnection()
->query('SELECT iid FROM {aggregator_item} WHERE fid = :fid AND timestamp < :timestamp', array(
':fid' => $feed
->id(),
':timestamp' => $age,
))
->fetchCol();
if ($iids) {
entity_delete_multiple('aggregator_item', $iids);
}
}
}