function _revisioning_publish_revision in Revisioning 6.4
Same name and namespace in other branches
- 8 revisioning_api.inc \_revisioning_publish_revision()
- 6 revisioning.module \_revisioning_publish_revision()
- 6.3 revisioning_api.inc \_revisioning_publish_revision()
- 7 revisioning_api.inc \_revisioning_publish_revision()
Make the supplied revision of the node current and publish it. It is the caller's responsibility to provide proper revision. Note that no check is made as to whether the initiating user has permission to publish this revision.
@TODO: Shouldn't we invoke hook_nodeapi('update'..) too, since we are updating node ?
Parameters
$node: Target $node object (loaded with target revision) or nid of target node
$vid: optional vid of revision to make current, if provided $node is not object.
2 calls to _revisioning_publish_revision()
- revisioning_publish_confirm_submit in ./
revisioning.pages.inc - Submission handler for the publish_confirm form.
- _revisioning_publish_latest_revision in ./
revisioning_api.inc - Find the most recent pending revision, make it current, unless it already is and publish node. Note that no check is made as to whether the initiating user has permission to publish this node.
File
- ./
revisioning_api.inc, line 276 - API functions of Revisioning module
Code
function _revisioning_publish_revision(&$node, $vid = NULL) {
$node_revision = is_object($node) ? $node : node_load($node, $vid);
module_invoke_all('revisionapi', 'pre publish', $node_revision);
// Update node table, making sure the "published" (ie. status) flag is set
db_query("UPDATE {node} SET vid=%d, title='%s', status=1 WHERE nid=%d", $node_revision->vid, $node_revision->title, $node_revision->nid);
cache_clear_all();
watchdog('content', 'Published rev #%revision of @type %title', array(
'@type' => $node_revision->type,
'%title' => $node_revision->title,
'%revision' => $node_revision->vid,
), WATCHDOG_NOTICE, l(t('view'), "node/{$node_revision->nid}/revisions/{$node_revision->vid}/view"));
module_invoke_all('revisionapi', 'post publish', $node_revision);
}