function workflow_cron in Workflow 5
Same name and namespace in other branches
- 8 workflow.module \workflow_cron()
- 5.2 workflow.module \workflow_cron()
- 6.2 workflow.module \workflow_cron()
- 6 workflow.module \workflow_cron()
- 7.2 workflow.module \workflow_cron()
- 7 workflow.module \workflow_cron()
Implementation of hook_cron
File
- ./
workflow.module, line 1949
Code
function workflow_cron() {
$clear_cache = FALSE;
//if the time now is greater than the time to publish a node, publish it
$nodes = db_query('SELECT * FROM {workflow_scheduled_transition} s WHERE s.scheduled > 0 AND s.scheduled < %d', time());
while ($row = db_fetch_object($nodes)) {
$node = node_load($row->nid);
// make sure transition is still valid
if ($node->_workflow == $row->old_sid) {
// do transistion
workflow_execute_transition($node, $row->sid, $row->comment);
watchdog('content', t('%type: scheduled transition of %title.', array(
'%type' => t($node->type),
'%title' => $node->title,
)), WATCHDOG_NOTICE, l(t('view'), 'node/' . $node->nid));
$clear_cache = TRUE;
}
}
if ($clear_cache) {
// clear the cache so an anonymous poster can see the node being published or unpublished
cache_clear_all();
}
}