You are here

public static function FeedImportSQLHashes::getExpired in Feed Import 8

Returns an array of expired entity ids keyed by entity name

Parameters

string $name: Feed machine name

int $max: Max number of ids or 0 for all

Return value

array An array of expired items. Format: entity_name: hash_id: enity_id

Overrides FeedImportStaticHashManager::getExpired

File

feed_import_base/src/FeedImportSQLHashes.php, line 253

Class

FeedImportSQLHashes
This class implements SQL hash storage

Namespace

Drupal\feed_import_base

Code

public static function getExpired($name, $max = 0) {
  $q = db_select('feed_import_hashes', 'f')
    ->fields('f', array(
    'entity',
    'id',
    'entity_id',
  ))
    ->condition('feed_machine_name', $name)
    ->condition('expire', array(
    static::MARK_PROTECTED + 1,
    time(),
  ), 'BETWEEN');
  if ($max) {
    $q
      ->range(0, $max);
  }
  $q = $q
    ->execute();
  $ret = array();
  while ($r = $q
    ->fetch(PDO::FETCH_ASSOC)) {
    $ret[$r['entity']][$r['id']] = $r['entity_id'];
  }
  return $ret;
}