You are here

public function UltimateCronQueueSettings::cleanup in Ultimate Cron 7.2

Cleanup job for queue plugin.

File

plugins/ultimate_cron/settings/queue.class.php, line 206
Queue settings for Ultimate Cron.

Class

UltimateCronQueueSettings
Queue settings plugin class.

Code

public function cleanup() {

  // Make sure we don't stumble upon system cron job.
  $job = _ultimate_cron_job_load('system_cron');
  if ($job && !$job
    ->lock()) {
    return;
  }

  // This comes from system.module's system_cron().
  // We do not want to run system_cron every 1 minute, but we need to
  // keep the expire values fresh in the queue table.
  // Reset expired items in the default queue implementation table. If that's
  // not used, this will simply be a no-op.
  db_update('queue')
    ->fields(array(
    'expire' => 0,
  ))
    ->condition('expire', 0, '<>')
    ->condition('expire', REQUEST_TIME, '<')
    ->execute();
  $job
    ->unlock();
}