Error message

You are browsing documentation for drupal 7.x, which is not supported anymore. Read the updated version of this page for drupal 11.x (the latest version).

function node_revision_delete

Same name and namespace in other branches
  1. 10 core/modules/node/node.module \node_revision_delete()
  2. 9 core/modules/node/node.module \node_revision_delete()
  3. 8.9.x core/modules/node/node.module \node_revision_delete()

Deletes a node revision.

Parameters

$revision_id: The revision ID to delete.

2 calls to node_revision_delete()
node_revision_delete_confirm_submit in modules/node/node.pages.inc
Form submission handler for node_revision_delete_confirm().
node_user_delete in modules/node/node.module
Implements hook_user_delete().

File

modules/node/node.module, line 1297

Code

function node_revision_delete ($revision_id) {
 if ($revision = node_load (NULL, $revision_id)) {
 // Prevent deleting the current revision.
 $node = node_load ($revision->nid);
 if ($revision_id == $node->vid) {
 return FALSE;
 }
 db_delete ('node_revision')->condition ('nid', $revision->nid)
 ->condition ('vid', $revision->vid)
 ->execute ();
 module_invoke_all ('node_revision_delete', $revision);
 field_attach_delete_revision ('node', $revision);
 return TRUE;
 }
 return FALSE;
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.