You are here

public function FeedsNodeProcessor::expire in Feeds 6

Same name and namespace in other branches
  1. 7 plugins/FeedsNodeProcessor.inc \FeedsNodeProcessor::expire()

Implement expire().

Overrides FeedsProcessor::expire

File

plugins/FeedsNodeProcessor.inc, line 129
Class definition of FeedsNodeProcessor.

Class

FeedsNodeProcessor
Creates nodes from feed items.

Code

public function expire($time = NULL) {
  if ($time === NULL) {
    $time = $this
      ->expiryTime();
  }
  if ($time == FEEDS_EXPIRE_NEVER) {
    return;
  }
  $result = db_query_range("SELECT n.nid FROM {node} n JOIN {feeds_node_item} fni ON n.nid = fni.nid WHERE fni.id = '%s' AND n.created < %d", $this->id, FEEDS_REQUEST_TIME - $time, 0, variable_get('feeds_node_batch_size', FEEDS_NODE_BATCH_SIZE));
  while ($node = db_fetch_object($result)) {
    _feeds_node_delete($node->nid);
  }
  if (db_result(db_query_range("SELECT n.nid FROM {node} n JOIN {feeds_node_item} fni ON n.nid = fni.nid WHERE fni.id = '%s' AND n.created < %d", $this->id, FEEDS_REQUEST_TIME - $time, 0, 1))) {
    return FEEDS_BATCH_ACTIVE;
  }
  return FEEDS_BATCH_COMPLETE;
}