mob_queue.module in Drush Queue Handling 7
Same filename and directory in other branches
Module for the cron queue management - a small yet powerful queue tool
File
mob_queue.moduleView source
<?php
/**
* @file
* Module for the cron queue management - a small yet powerful queue tool
*/
/**
* Implements hook_menu().
*/
function mob_queue_menu() {
$items = array();
$items['admin/config/system/mob_queue'] = array(
'title' => 'Drush Queue Handling Configuration',
'description' => 'Pick and choose queues to handle.',
'page callback' => 'drupal_get_form',
'page arguments' => array(
'mob_queue_settings',
),
'access arguments' => array(
'administer mob_queue',
),
'type' => MENU_NORMAL_ITEM,
);
return $items;
}
/**
* Implements hook_form_alter().
*
* Switching off queue run on cron run.
*/
function mob_queue_settings($form) {
$queues = module_invoke_all('cron_queue_info');
$form['mob_qinfo'] = array(
'#type' => 'fieldset',
'#title' => t('Drush Queue Handling'),
);
foreach ($queues as $name => $queue) {
$form['mob_qinfo']['mob_queue_' . $name] = array(
'#type' => 'checkbox',
'#title' => $name,
'#description' => t('Turn off queue @name process in cron.', array(
'@name' => $name,
)),
'#default_value' => variable_get('mob_queue_' . $name, 0),
'#weight' => 1,
);
}
return system_settings_form($form);
}
/**
* Implements hook_cron_info_alter().
*/
function mob_queue_cron_queue_info_alter(&$queues) {
foreach ($queues as $name => $queue) {
if (variable_get('mob_queue_' . $name, 0)) {
$queues[$name]['mob_queue'] = TRUE;
$queues[$name]['skip on cron'] = TRUE;
}
}
}
/**
* Implements hook_permission().
*/
function mob_queue_permission() {
return array(
'administer mob_queue' => array(
'title' => t('Administer Drush Queue Handling'),
'description' => t('Configure drush queue handling settings.'),
),
);
}
Functions
Name | Description |
---|---|
mob_queue_cron_queue_info_alter | Implements hook_cron_info_alter(). |
mob_queue_menu | Implements hook_menu(). |
mob_queue_permission | Implements hook_permission(). |
mob_queue_settings | Implements hook_form_alter(). |