function queue_example_add_remove_form_run_cron

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'
queue_example_add_remove_form in queue_example/queue_example.module
Form generator for managing the queue.

File

queue_example/queue_example.module, line 260

Code

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