You are here

function revisioning_delete_archived_revisions in Revisioning 7

Same name and namespace in other branches
  1. 8 revisioning_api.inc \revisioning_delete_archived_revisions()
  2. 6.3 revisioning_api.inc \revisioning_delete_archived_revisions()

Delete all revisions with a vid less than the current.

Use node_revision_delete from node.module to ensure that we cleanup not only node revisions but also all attached field revisions as well.

2 calls to revisioning_delete_archived_revisions()
revisioning_delete_archived_action in ./revisioning_triggers_actions.inc
As declared in revisioning_action_info().
revisioning_delete_archived_confirm_submit in ./revisioning.pages.inc
Submission handler for the delete_archived_confirm form.

File

./revisioning_api.inc, line 98
API functions of Revisioning module

Code

function revisioning_delete_archived_revisions($node) {
  $revisions = db_select('node_revision', 'n')
    ->fields('n', array(
    'vid',
  ))
    ->condition('n.nid', $node->nid)
    ->condition('n.vid', $node->current_revision_id, '<')
    ->execute();
  foreach ($revisions as $rev) {
    node_revision_delete($rev->vid);
  }
}