You are here

function revisioning_revert_confirm_submit in Revisioning 6

Submission handler for the revert_confirm form.

Forward on to the existing revert function in node.pages.inc, then triggers a 'revert' event that may be actioned upon.

Note: It would be nice if publish and revert were symmetrical operations and that node_revision_revert_cofirm_submit didn't save a copy of the revision (under a new vid), as this has the side-effect of making all "pending" revisions "old" because the definition of "pending" is "node_vid > current_vid". It would be better if "pending" relied on a separate flag rather than a field such as vid (or a timestamp) that changes everytime a piece of code executes a node_save.

File

./revisioning.module, line 363

Code

function revisioning_revert_confirm_submit($form, &$form_state) {
  $node = $form['#node_revision'];

  // Next call redirects to node/%/revisions
  node_revision_revert_confirm_submit($form, $form_state);

  // Make sure node gets published, i.e. has its status flag set
  db_query("UPDATE {node} SET status=1 WHERE nid=%d", $node->nid);
  cache_clear_all();

  // Invoke the revisioning trigger passing 'revert' as the operation
  module_invoke_all('revisioning', 'revert');
}