function _revisioning_revert_revision in Revisioning 7
Same name and namespace in other branches
- 8 revisioning_api.inc \_revisioning_revert_revision()
- 6.4 revisioning_api.inc \_revisioning_revert_revision()
- 6.3 revisioning_api.inc \_revisioning_revert_revision()
Revert node to selected revision without publishing it.
This is same as node_revision_revert_confirm_submit() in node_pages.inc, except it doesn't put any messages on screen.
Parameters
object|int $node: Target $node object (loaded with target revision) or nid of target node
int $vid: (optional) vid of revision to revert to, if provided $node is not an object.
1 call to _revisioning_revert_revision()
- _revisioning_revertpublish_revision in ./
revisioning_api.inc - Revert node to selected revision without changing its publication status.
File
- ./
revisioning_api.inc, line 360 - API functions of Revisioning module
Code
function _revisioning_revert_revision(&$node, $vid = NULL) {
$node_revision = is_object($node) ? $node : node_load($node, $vid);
$node_revision->revision = 1;
$node_revision->log = t('Copy of the revision from %date.', array(
'%date' => format_date($node_revision->revision_timestamp),
));
if (module_exists('taxonomy')) {
$node_revision->taxonomy = array_keys($node_revision->taxonomy);
}
node_save($node_revision);
watchdog('content', '@type: reverted %title revision %revision.', array(
'@type' => $node_revision->type,
'%title' => $node_revision->title,
'%revision' => $node_revision->vid,
));
}