node_revision_create

Versions
4.6
node_revision_create($node)

Create and return a new revision of the given node.

Code

modules/node.module, line 1018

<?php
function node_revision_create($node) {
  global $user;

  // "Revision" is the name of the field used to indicate that we have to
  // create a new revision of a node.
  if ($node->nid && $node->revision) {
    $prev = node_load(array('nid' => $node->nid));
    $node->revisions = $prev->revisions;
    unset($prev->revisions);
    $node->revisions[] = array('uid' => $user->uid, 'timestamp' => time(), 'node' => $prev, 'history' => $node->history);
  }

  return $node;
}
?>
Login or register to post comments
 
 

All source code and documentation on this site is released under the terms of the GNU General Public License, version 2 and later. Drupal is a registered trademark of Dries Buytaert.