Same name and namespace in other branches
  1. 7.x modules/node/node.module \_node_save_revision()

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 modules/node/node.module
Save a node object into the database.

File

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;
}