summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Rothstein <drothstein@gmail.com>2013-12-30 14:28:14 -0500
committerDavid Rothstein <drothstein@gmail.com>2013-12-30 14:28:14 -0500
commite868ee8451d1778a405a730f19292538de6d7921 (patch)
tree18cde7d1f3d710f48e8154c32cb9781caf78a37f
parent226fe6997057f1b2b58116e7bc35ffbcbaed726c (diff)
downloadbrdo-e868ee8451d1778a405a730f19292538de6d7921.tar.gz
brdo-e868ee8451d1778a405a730f19292538de6d7921.tar.bz2
Issue #2136369 by marvil07: Provide a way to avoid processing a queue during cron execution.
-rw-r--r--CHANGELOG.txt2
-rw-r--r--includes/common.inc4
-rw-r--r--modules/system/system.api.php3
3 files changed, 9 insertions, 0 deletions
diff --git a/CHANGELOG.txt b/CHANGELOG.txt
index 9e82e69bd..62828ac0e 100644
--- a/CHANGELOG.txt
+++ b/CHANGELOG.txt
@@ -1,6 +1,8 @@
Drupal 7.25, xxxx-xx-xx (development version)
-----------------------
+- Added an optional 'skip on cron' parameter to hook_cron_queue_info() to allow
+ queues to avoid being automatically processed on cron runs (API addition).
- Fixed a bug which caused hook_block_view_MODULE_DELTA_alter() to never be
invoked if the block delta had a hyphen in it. To implement the hook when the
block delta has a hyphen, modules should now replace hyphens with underscores
diff --git a/includes/common.inc b/includes/common.inc
index 38895c542..3b4bf580c 100644
--- a/includes/common.inc
+++ b/includes/common.inc
@@ -5282,6 +5282,10 @@ function drupal_cron_run() {
}
foreach ($queues as $queue_name => $info) {
+ if (!empty($info['skip on cron'])) {
+ // 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 276dbca18..f54078b6d 100644
--- a/modules/system/system.api.php
+++ b/modules/system/system.api.php
@@ -610,6 +610,9 @@ 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 on cron': (optional) Set to TRUE to avoid being processed during
+ * cron runs (for example, if you want to control all queue execution
+ * manually).
*
* @see hook_cron()
* @see hook_cron_queue_info_alter()