public function DefaultProcessor::postProcess in Drupal 8
Same name and namespace in other branches
- 9 core/modules/aggregator/src/Plugin/aggregator/processor/DefaultProcessor.php \Drupal\aggregator\Plugin\aggregator\processor\DefaultProcessor::postProcess()
Implements \Drupal\aggregator\Plugin\ProcessorInterface::postProcess().
Expires items from a feed depending on expiration settings.
Overrides ProcessorInterface::postProcess
File
- core/
modules/ aggregator/ src/ Plugin/ aggregator/ processor/ DefaultProcessor.php, line 255
Class
- DefaultProcessor
- Defines a default processor implementation.
Namespace
Drupal\aggregator\Plugin\aggregator\processorCode
public function postProcess(FeedInterface $feed) {
$aggregator_clear = $this->configuration['items']['expire'];
if ($aggregator_clear != FeedStorageInterface::CLEAR_NEVER) {
// Delete all items that are older than flush item timer.
$age = REQUEST_TIME - $aggregator_clear;
$result = $this->itemStorage
->getQuery()
->condition('fid', $feed
->id())
->condition('timestamp', $age, '<')
->execute();
if ($result) {
$entities = $this->itemStorage
->loadMultiple($result);
$this->itemStorage
->delete($entities);
}
}
}