From 43db2bd50dff658bb5dc9f5f1be9f64cb93fb87e Mon Sep 17 00:00:00 2001 From: Marco Villegas Date: Fri, 15 Nov 2013 00:54:16 -0500 Subject: [PATCH] Provide a way to avoid processing a queue during cron execution. --- includes/common.inc | 4 ++++ modules/system/system.api.php | 2 ++ 2 files changed, 6 insertions(+) diff --git a/includes/common.inc b/includes/common.inc index de31897..9b46b10 100644 --- a/includes/common.inc +++ b/includes/common.inc @@ -5258,6 +5258,10 @@ function drupal_cron_run() { } foreach ($queues as $queue_name => $info) { + if (!empty($info['skip cron run'])) { + // Do not run if queue wants to skip. + continue; + } $function = $info['worker callback']; $end = time() + (isset($info['time']) ? $info['time'] : 15); $queue = DrupalQueue::get($queue_name); diff --git a/modules/system/system.api.php b/modules/system/system.api.php index 276dbca..1055de4 100644 --- a/modules/system/system.api.php +++ b/modules/system/system.api.php @@ -610,6 +610,8 @@ function hook_cron() { * with one argument, the item created via DrupalQueue::createItem(). * - 'time': (optional) How much time Drupal should spend on calling this * worker in seconds. Defaults to 15. + * - 'skip cron run': (optional) Set to TRUE to avoid being processed during + * cron runs. i.e. you want to control all queue execution manually. * * @see hook_cron() * @see hook_cron_queue_info_alter() -- 1.7.10.4