You are here

protected static function FeedImport::updateIds in Feed Import 7.2

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

Update imported items ids in feed_import_hashes

Parameters

mixed $value: An int value to add id to list or an array containing info about update conditions to execute update

1 call to FeedImport::updateIds()
FeedImport::saveEntities in ./feed_import.inc.php
Saves/updates all created entities

File

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

Class

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

Code

protected static function updateIds($value) {
  static $update_ids = array();
  if (is_array($value)) {
    if (empty($update_ids)) {
      return;
    }
    $q_update = db_update('feed_import_hashes')
      ->fields(array(
      'expire' => $value['expire'],
    ))
      ->condition('feed_machine_name', $value['feed_machine_name'], '=');
    $conditions =& $q_update
      ->conditions();

    // Split in chunks.
    $update_ids = array_chunk($update_ids, variable_get('feed_import_update_ids_chunk', 1000));
    foreach ($update_ids as &$ids) {
      $q_update
        ->condition('id', $ids, 'IN')
        ->execute();

      // Remove last IN condition.
      array_pop($conditions);
      $ids = NULL;
    }

    // Reset update ids.
    $update_ids = array();
  }
  else {

    // Add to list.
    $update_ids[] = (int) $value;
  }
}