function _revisioning_delete_revision in Revisioning 7
Same name and namespace in other branches
- 8 revisioning_api.inc \_revisioning_delete_revision()
- 6.4 revisioning_api.inc \_revisioning_delete_revision()
- 6.3 revisioning_api.inc \_revisioning_delete_revision()
Delete selected revision of node, provided it's not current.
This is same as node_revision_delete_confirm_submit() in node_pages.inc, except it doesn't put any messages on the screen. This way it becomes reusable (eg. in actions).
@TODO: Insert check to prevent deletion of current revision of node.
Parameters
object $node: Target $node object (loaded with target revision) or nid of target node
int $vid: (optional) vid of revision to delete, if provided $node is not object.
File
- ./
revisioning_api.inc, line 442 - API functions of Revisioning module
Code
function _revisioning_delete_revision(&$node, $vid = NULL) {
$node_revision = is_object($node) ? $node : node_load($node, $vid);
module_invoke_all('revisionapi', 'pre delete', $node_revision);
db_delete('node_revision')
->condition('vid', $node_revision->vid)
->execute();
watchdog('content', '@type: deleted %title revision %revision.', array(
'@type' => $node_revision->type,
'%title' => $node_revision->title,
'%revision' => $node_revision->vid,
));
module_invoke_all('revisionapi', 'post delete', $node_revision);
}