You are here

protected function FeedsProcessor::expiryQuery in Feeds 8.2

Returns a database query used to select entities to expire.

Processor classes should override this method to set the age portion of the query.

Parameters

FeedsSource $source: The feed source.

int $time: Delete entities older than this.

Return value

SelectQuery A select query to execute.

See also

FeedsNodeProcessor::expiryQuery()

2 calls to FeedsProcessor::expiryQuery()
FeedsNodeProcessor::expiryQuery in lib/Drupal/feeds/Plugin/feeds/processor/FeedsNodeProcessor.php
Overrides parent::expiryQuery().
FeedsProcessor::expire in lib/Drupal/feeds/Plugin/FeedsProcessor.php
Deletes feed items older than REQUEST_TIME - $time.
1 method overrides FeedsProcessor::expiryQuery()
FeedsNodeProcessor::expiryQuery in lib/Drupal/feeds/Plugin/feeds/processor/FeedsNodeProcessor.php
Overrides parent::expiryQuery().

File

lib/Drupal/feeds/Plugin/FeedsProcessor.php, line 470
Contains FeedsProcessor and related classes.

Class

FeedsProcessor
Abstract class, defines interface for processors.

Namespace

Drupal\feeds\Plugin

Code

protected function expiryQuery(FeedsSource $source, $time) {

  // Build base select statement.
  $info = $this
    ->entityInfo();
  $id_key = db_escape_field($info['entity_keys']['id']);
  $select = db_select($info['base_table'], 'e');
  $select
    ->addField('e', $info['entity_keys']['id'], 'entity_id');
  $select
    ->join('feeds_item', 'fi', "e.{$id_key} = fi.entity_id AND fi.entity_type = :entity_type", array(
    ':entity_type' => $this
      ->entityType(),
  ));
  $select
    ->condition('fi.id', $this->id);
  $select
    ->condition('fi.feed_nid', $source->feed_nid);
  return $select;
}