function rules_action_delete_node in Rules 6
Same name and namespace in other branches
- 7.2 tests/rules_test.test.inc \rules_action_delete_node()
Action "Delete a node".
We cannot use node_delete() because it does access checks and output.
See also
Related topics
File
- rules/
modules/ node.rules.inc, line 309 - rules integration for the node module
Code
function rules_action_delete_node($node) {
db_query('DELETE FROM {node} WHERE nid = %d', $node->nid);
db_query('DELETE FROM {node_revisions} 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,
));
}