You are here

function _revision_deletion_delete_revision in Revision Deletion 7

Borrows heavily from the node.module api function to delete revisions.

With some of the checks and messages removed. No check to make sure we are not deleting the current node revision. That is covered in the function that creates the data set.

2 calls to _revision_deletion_delete_revision()
revision_deletion_cron in ./revision_deletion.module
Implements hook_cron().
_revision_deletion_delete_revisions in ./revision_deletion.helpers.inc
Delete nodes.

File

./revision_deletion.helpers.inc, line 127
Helper functions.

Code

function _revision_deletion_delete_revision($nid) {
  $node = node_load(NULL, $nid);
  if (!is_object($node)) {
    watchdog('Revision Deletion', 'failed (nid @revision) not an object.', array(
      '@revision' => $nid,
    ));
    return FALSE;
  }
  $st = node_revision_delete($node->vid);
  $array_values = array(
    '@type' => $node->type,
    '%title' => $node->title,
    '@node' => $node->nid,
    '@revision' => $node->vid,
  );
  if ($st) {
    watchdog('Revision Deletion', '%title (@type, node @node, revision @revision) deleted.', $array_values);
  }
  else {
    watchdog('Revision Deletion', '%title (@type, node @node, revision @revision) delete failed.', $array_values);
  }
}