You are here

function _revisioning_unpublish_node in Revisioning 6.3

Same name and namespace in other branches
  1. 8 revisioning_api.inc \_revisioning_unpublish_node()
  2. 6.4 revisioning_api.inc \_revisioning_unpublish_node()
  3. 7 revisioning_api.inc \_revisioning_unpublish_node()

Unpublish node, without calling node_save().

Parameters

$node: Target $node object or nid.

$clear_cache: Whether to clear the cache afterwards or not. Clearing the cache on every node during bulk operations can be time-consuming.

1 call to _revisioning_unpublish_node()
_revisioning_unpublish_revision in ./revisioning_api.inc
Unpublish revision (i.e. the node).

File

./revisioning_api.inc, line 257
API functions of Revisioning module

Code

function _revisioning_unpublish_node($node, $clear_cache = TRUE) {
  if (is_numeric($node)) {
    $node = node_load($node);
  }
  db_query("UPDATE {node} SET status=0 WHERE nid=%d", $node->nid);

  // Let other modules know there was an update on the node, just like
  // node_save() does.
  $node->status = 0;
  $node->bypass_nodeapi = TRUE;

  // avoid revisioning_nodeapi() doing stuff
  $node->pathauto_perform_alias = FALSE;

  // avoid pathauto_nodeapi() doing stuff
  node_invoke_nodeapi($node, 'update');

  // Update the node access table for this node.
  node_access_acquire_grants($node);
  if ($clear_cache) {
    cache_clear_all();
  }
}