You are here

function revision_deletion_cron in Revision Deletion 5

Same name and namespace in other branches
  1. 6 revision_deletion.module \revision_deletion_cron()
  2. 7 revision_deletion.module \revision_deletion_cron()

Implementation of hook_cron().

File

./revision_deletion.module, line 107
Node Revision Deletion, written by Greg Holsclaw

Code

function revision_deletion_cron() {
  $last_update = variable_get('revision_delete_cron', 0);
  $rev_del_freq = variable_get('revision_delete_freq', 0);
  $diff = $rev_del_freq == 0 ? 0 : time() - $rev_del_freq;
  if ($diff > $last_update) {
    $revisions = revision_deletion_get_list();
    foreach ($revisions as $data) {
      if ($data->select) {
        revision_deletion_delete_rev($data);
      }
    }
    variable_set('revision_delete_cron', time());
  }
}