You are here

function bulkdelete_node_delete_quick in Bulk Delete 6

Qucikly delete nodes. The trick is to avoid node_delete() that fully loads a node in advance. We try to discover all implementations of hook_delete().

1 string reference to 'bulkdelete_node_delete_quick'
bulkdelete_form_submit in ./bulkdelete.admin.inc

File

./bulkdelete.module, line 43
Main file of the bulkdelete module.

Code

function bulkdelete_node_delete_quick($nids, $node_deletes = array()) {
  foreach ($nids as $nid) {

    // Reset the static cache to keep memory down.
    $node = node_load($nid, NULL, TRUE);

    // Note that the user calling this has administer nodes privileges, and
    // can thus delete without an access check.
    // Call the node-specific callback (if any):
    foreach ($node_deletes as $function) {
      $function($node);
    }
    db_query('DELETE FROM {node} WHERE nid = %d', $node->nid);
    db_query('DELETE FROM {node_revisions} WHERE nid = %d', $node->nid);
    if (module_exists('search')) {
      search_wipe($row->nid, 'node');
    }
  }
}