function _node_save_revision

7.x node.module _node_save_revision($node, $uid, $update = NULL)
6.x node.module _node_save_revision(&$node, $uid, $update = NULL)

Helper function to save a revision with the uid of the current user.

Node is taken by reference, becuse drupal_write_record() updates the $node with the revision id, and we need to pass that back to the caller.

1 call to _node_save_revision()
node_save in drupal-6.x/modules/node/node.module
Save a node object into the database.

File

drupal-6.x/modules/node/node.module, line 959
The core that allows content to be submitted to the site. Modules and scripts may programmatically submit nodes using the usual form API pattern.

Code

function _node_save_revision(&$node, $uid, $update = NULL) {
  $temp_uid = $node->uid;
  $node->uid = $uid;
  if (isset($update)) {
    drupal_write_record('node_revisions', $node, $update);
  }
  else {
    drupal_write_record('node_revisions', $node);
  }
  $node->uid = $temp_uid;
}