You are here

public static function FeedImport::deleteItemsbyEntityId in Feed Import 7.2

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

Deletes items by entity id

Parameters

array $eids: Entity ids keyed by entity name

2 calls to FeedImport::deleteItemsbyEntityId()
feed_import_add_to_delete in ./feed_import.module
Schedule an item for removing from feed import items at the end of the script
feed_import_delete_items in ./feed_import.module
Delete feed items and set report

File

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

Class

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

Code

public static function deleteItemsbyEntityId(array $eids) {
  if (empty($eids)) {
    return;
  }
  $chunk = variable_get('feed_import_update_ids_chunk', 1000);
  $q_delete = db_delete('feed_import_hashes');
  $conditions =& $q_delete
    ->conditions();
  foreach ($eids as $entity => &$ids) {
    $q_delete
      ->condition('entity', $entity, '=');
    $ids = array_chunk($ids, $chunk);
    foreach ($ids as &$id) {
      $q_delete
        ->condition('entity_id', $id, 'IN')
        ->execute();

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

    // Remove entity condition.
    array_pop($conditions);
  }
}