You are here

public static function FeedImport::getExpiredItems in Feed Import 7.2

Same name and namespace in other branches
  1. 7 feed_import.inc.php \FeedImport::getExpiredItems()

Get expired items

Parameters

int $limit: Limit the number of returned items

Return value

array Array keyed with entity names and value entity_ids

1 call to FeedImport::getExpiredItems()
feed_import_cron in ./feed_import.module
Implements hook_cron().

File

./feed_import.inc.php, line 377
Feed import class for parsing and processing content.

Class

FeedImport
@file Feed import class for parsing and processing content.

Code

public static function getExpiredItems($limit = NULL) {
  $results = db_select('feed_import_hashes', 'f')
    ->fields('f', array(
    'entity',
    'entity_id',
  ))
    ->condition('expire', array(
    1,
    REQUEST_TIME,
  ), 'BETWEEN');
  if ($limit !== NULL) {
    $results
      ->range(0, $limit);
  }
  $results = $results
    ->execute()
    ->fetchAll();
  if (empty($results)) {
    return $results;
  }
  $res = array();
  foreach ($results as &$result) {
    $res[$result->entity][] = $result->entity_id;
    $result = NULL;
  }
  unset($results);
  return $res;
}