/**
  * {@inheritdoc}
  */
 public function getFeedDuplicates(FeedInterface $feed)
 {
     $query = \Drupal::entityQuery('aggregator_feed');
     $or_condition = $query->orConditionGroup()->condition('title', $feed->label())->condition('url', $feed->getUrl());
     $query->condition($or_condition);
     if ($feed->id()) {
         $query->condition('fid', $feed->id(), '<>');
     }
     return $this->loadMultiple($query->execute());
 }
 /**
  * Implements \Drupal\aggregator\Plugin\ProcessorInterface::postProcess().
  *
  * Expires items from a feed depending on expiration settings.
  */
 public function postProcess(FeedInterface $feed)
 {
     $aggregator_clear = $this->configuration['items']['expire'];
     if ($aggregator_clear != AGGREGATOR_CLEAR_NEVER) {
         // Delete all items that are older than flush item timer.
         $age = REQUEST_TIME - $aggregator_clear;
         $result = $this->itemQuery->condition('fid', $feed->id())->condition('timestamp', $age, '<')->execute();
         if ($result) {
             $entities = $this->itemStorage->loadMultiple($result);
             $this->itemStorage->delete($entities);
         }
     }
 }
 /**
  * Confirms an item removal from a feed.
  *
  * @param \Drupal\aggregator\FeedInterface $feed
  *   Feed object representing the feed.
  */
 public function deleteFeedItems(FeedInterface $feed)
 {
     $this->drupalPostForm('admin/config/services/aggregator/delete/' . $feed->id(), array(), t('Delete items'));
     $this->assertRaw(t('The news items from %title have been deleted.', array('%title' => $feed->label())), 'Feed items deleted.');
 }
Example #4
0
 /**
  * {@inheritdoc}
  */
 public function getItemCount(FeedInterface $feed)
 {
     $query = \Drupal::entityQuery('aggregator_item')->condition('fid', $feed->id())->count();
     return $query->execute();
 }