function node_delete
7.x node.module | node_delete($nid) |
6.x node.module | node_delete($nid) |
Delete a node.
4 calls to node_delete()
- blogapi_blogger_delete_post in drupal-6.x/
modules/ blogapi/ blogapi.module - Blogging API callback. Removes the specified blog node.
- forum_taxonomy in drupal-6.x/
modules/ forum/ forum.module - Implementation of hook_taxonomy().
- node_delete_confirm_submit in drupal-6.x/
modules/ node/ node.pages.inc - Execute node deletion
- node_multiple_delete_confirm_submit in drupal-6.x/
modules/ node/ node.admin.inc
File
- drupal-6.x/
modules/ node/ node.module, line 974 - The core that allows content to be submitted to the site. Modules and scripts may programmatically submit nodes using the usual form API pattern.
Code
function node_delete($nid) {
// Clear the cache before the load, so if multiple nodes are deleted, the
// memory will not fill up with nodes (possibly) already removed.
$node = node_load($nid, NULL, TRUE);
if (node_access('delete', $node)) {
db_query('DELETE FROM {node} WHERE nid = %d', $node->nid);
db_query('DELETE FROM {node_revisions} WHERE nid = %d', $node->nid);
db_query('DELETE FROM {node_access} WHERE nid = %d', $node->nid);
// Call the node-specific callback (if any):
node_invoke($node, 'delete');
node_invoke_nodeapi($node, 'delete');
// Clear the page and block caches.
cache_clear_all();
// Remove this node from the search index if needed.
if (function_exists('search_wipe')) {
search_wipe($node->nid, 'node');
}
watchdog('content', '@type: deleted %title.', array('@type' => $node->type, '%title' => $node->title));
drupal_set_message(t('@type %title has been deleted.', array('@type' => node_get_types('name', $node), '%title' => $node->title)));
}
}