bulkdelete.module in Bulk Delete 6
Same filename and directory in other branches
Main file of the bulkdelete module.
File
bulkdelete.moduleView source
<?php
/**
* @file
* Main file of the bulkdelete module.
*/
/**
* Implementation of hook_menu().
*/
function bulkdelete_menu() {
$items = array();
$items['admin/content/node/delete'] = array(
'title' => 'Bulk delete nodes',
'page callback' => 'drupal_get_form',
'page arguments' => array(
'bulkdelete_form',
),
'access arguments' => array(
'administer nodes',
),
'type' => MENU_LOCAL_TASK,
'weight' => 11,
'file' => 'bulkdelete.admin.inc',
);
/*
$items['admin/content/taxonomy/delete'] = array(
'title' => 'Bulk delete terms',
'page callback' => 'drupal_get_form',
'page arguments' => array('bulkdelete_terms_form'),
'access arguments' => array('administer taxonomy'),
'type' => MENU_LOCAL_TASK,
'weight' => 11,
'file' => 'bulkdelete.admin.inc',
);
*/
return $items;
}
/**
* 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().
*/
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');
}
}
}
/**
* Use the core API to delete the nodes.
*/
function bulkdelete_node_delete_standard($nids) {
foreach ($nids as $nid) {
node_delete($nid);
}
}
Functions
Name | Description |
---|---|
bulkdelete_menu | Implementation of hook_menu(). |
bulkdelete_node_delete_quick | 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(). |
bulkdelete_node_delete_standard | Use the core API to delete the nodes. |