You are here

function revisioning_scheduler_cron in Revisioning 8

Same name and namespace in other branches
  1. 6.3 revisioning_scheduler/revisioning_scheduler.module \revisioning_scheduler_cron()
  2. 7 revisioning_scheduler/revisioning_scheduler.module \revisioning_scheduler_cron()

Implements hook_cron().

If there are any revisions with times that have passed, then publish them and delete them from the database.

File

revisioning_scheduler/revisioning_scheduler.module, line 327
Allows revisions to be published at specified dates and times.

Code

function revisioning_scheduler_cron() {
  module_load_include('inc', 'revisioning', 'revisioning_api');
  $result = db_query('SELECT * FROM {revisioning_scheduler} WHERE revision_date <= :date', array(
    ':date' => time(),
  ));
  foreach ($result as $revision) {
    if ($node_revision = node_load($revision->revision_nid, $revision->revision_vid)) {
      _revisioning_publish_revision($node_revision);
    }
    _revisioning_scheduler_unschedule_all_revisions($revision->revision_nid);
  }
}