queue_example_add_remove_form_run_cron

7 queue_example.module queue_example_add_remove_form_run_cron($form, &$form_state)
8 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

1 string reference to 'queue_example_add_remove_form_run_cron'

File

queue_example/queue_example.module, line 201
Examples demonstrating the Drupal Queue API.

Code

function queue_example_add_remove_form_run_cron($form, &$form_state) {
  drupal_cron_run();
  $queue = DrupalQueue::get($form_state['values']['queue_name']);
  $queue->createQueue(); // There is no harm in trying to recreate existing.
  $count = $queue->numberOfItems();
  drupal_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;
}
Login or register to post comments