You are here

protected function FeedsProcessor::expiryQuery in Feeds 7.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 plugins/FeedsNodeProcessor.inc
Overrides parent::expiryQuery().
FeedsProcessor::expire in plugins/FeedsProcessor.inc
Deletes feed items older than REQUEST_TIME - $time.
1 method overrides FeedsProcessor::expiryQuery()
FeedsNodeProcessor::expiryQuery in plugins/FeedsNodeProcessor.inc
Overrides parent::expiryQuery().

File

plugins/FeedsProcessor.inc, line 770
Contains FeedsProcessor and related classes.

Class

FeedsProcessor
Abstract class, defines interface for processors.

Code

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

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