You are here

function revisioning_scheduler_cron in Revisioning 6.3

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

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

@author Adam Bramley <adam@catalyst.net.nz>

File

revisioning_scheduler/revisioning_scheduler.module, line 154
Allows for revisions to be published at a specified time and date.

Code

function revisioning_scheduler_cron() {
  module_load_include('inc', 'revisioning', 'revisioning_api');
  $query = db_query('SELECT * FROM {revisioning_scheduler} WHERE revision_date <= %d', strtotime('now'));
  while ($revision = db_fetch_array($query)) {
    _revisioning_publish_revision($revision['revision_nid'], $revision['revision_vid']);
    db_query('DELETE FROM {revisioning_scheduler} WHERE revision_vid =%d AND revision_nid=%d', $revision['revision_vid'], $revision['revision_nid']);
  }
}