You are here

function revision_deletion_cron in Revision Deletion 7

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

Implements hook_cron().

4 string references to 'revision_deletion_cron'
node_revision_delete_update_7100 in ./revision_deletion.install
Update the variable names.
revision_deletion_admin_overview in ./revision_deletion.admin.inc
Form builder for the revisions overview administration form.
revision_deletion_install in ./revision_deletion.install
Implements hook_install().
revision_deletion_uninstall in ./revision_deletion.install
Implements hook_uninstall().

File

./revision_deletion.module, line 112

Code

function revision_deletion_cron() {
  $last_update = variable_get('revision_deletion_cron');
  $frequency = variable_get('revision_deletion_frequency');
  $difference = $frequency == 0 ? 0 : time() - $frequency;
  if ($difference > $last_update) {
    $revisions = _revision_deletion_get_list();
    foreach ($revisions as $revision) {
      if ($revision->select) {
        _revision_deletion_delete_revision($revision->vid);
      }
    }
    variable_set('revision_deletion_cron', time());
  }
}