1 queue_example.module | queue_example_add_remove_form_run_cron($form, &$form_state) |
Submit function for "run cron" button.
Runs cron (to release expired claims) and reports the results.
Related topics
File
- modules/
examples/ queue_example/ queue_example.module, line 257 - Hook implementations for the Queue Example module.
Code
function queue_example_add_remove_form_run_cron($form, &$form_state) {
backdrop_cron_run();
$queue = BackdropQueue::get($form_state['values']['queue_name']);
// There is no harm in trying to recreate existing.
$queue->createQueue();
$count = $queue->numberOfItems();
backdrop_set_message(t('Ran cron. If claimed items expired, they should be expired now. There are now @count items in the queue', array('@count' => $count)));
$form_state['rebuild'] = TRUE;
}