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


modules/examples/queue_example/queue_example.module, line 258
Examples demonstrating the Backdrop Queue API.


function queue_example_add_remove_form_run_cron($form, &$form_state) {
  $queue = BackdropQueue::get($form_state['values']['queue_name']);
  // There is no harm in trying to recreate existing.
  $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;