You are here

function _feedapi_aggregator_expire in FeedAPI 5

Check for expired items, pass them to the item_expire function

@TO DO Add cron timeout checking here, there may be too many items (nodes) to delete

We implement the same logic as a db query. The old code is

if (isset($item->arrived) || isset($item->timestamp)) { $diff = abs(time() - (isset($item->timestamp) ? $item->timestamp : $item->timestamp)); if ($diff > $settings['items_delete']) { ................ } }

File

feedapi_aggregator/feedapi_aggregator.module, line 541

Code

function _feedapi_aggregator_expire($feed, $settings) {
  $count = 0;
  if ($settings['items_delete'] > FEEDAPI_NEVER_DELETE_OLD) {
    $timexpire = time() - $settings['items_delete'];

    // @ TODO Review this query conditions
    $result = db_query("SELECT * FROM {feedapi_aggregator_item} WHERE feed_nid = %d AND timestamp > 0 AND timestamp < %d", $feed->nid, $timexpire);
    while ($item = db_fetch_object($result)) {

      // We callback feedapi for deleting
      $item->fiid = $item->iid;
      feedapi_expire_item($feed, $item);
      $count++;
    }
  }
  return $count;
}