You are here

function feed_import_add_to_delete in Feed Import 7

Same name and namespace in other branches
  1. 7.2 feed_import.module \feed_import_add_to_delete()

Schedule an item for removing from feed import items at the end of the script

Parameters

int $id: Entity id

string $type: Entity name

1 call to feed_import_add_to_delete()
feed_import_entity_delete in ./feed_import.module
Implements hook_entity_delete().

File

./feed_import.module, line 197
User interface, cron functions for feed_import module

Code

function feed_import_add_to_delete($id = NULL, $type = NULL) {

  // ids to delete
  static $ids = array();

  // if delete function is registered at shutdown
  static $registered = FALSE;
  if (!$registered) {

    // Register shutdown function
    drupal_register_shutdown_function(__FUNCTION__, NULL);
    $registered = TRUE;
  }

  // NULL means function is called at shutdown
  // so delete items
  if ($id == NULL) {
    FeedImport::deleteItemsbyEntityId($ids);

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

    // Just add to entities array an integer id
    $ids[$type][] = (int) $id;
  }
}