You are here

function cron_example_queue_report_work in Examples for Developers 7

Simple reporter for the workers.

Parameters

int $worker: Worker number.

object $item: The $item which was stored in the cron queue.

Related topics

2 calls to cron_example_queue_report_work()
cron_example_queue_1_worker in cron_example/cron_example.module
Simple worker for our queues.
cron_example_queue_2_worker in cron_example/cron_example.module
Simple worker for our queues.

File

cron_example/cron_example.module, line 243
Demonstrates use of the Cron API in Drupal - hook_cron()

Code

function cron_example_queue_report_work($worker, $item) {
  if (!empty($GLOBALS['cron_example_show_status_message'])) {
    drupal_set_message(t('Queue @worker worker processed item with sequence @sequence created at @time', array(
      '@worker' => $worker,
      '@sequence' => $item->sequence,
      '@time' => date_iso8601($item->created),
    )));
  }
  watchdog('cron_example', 'Queue @worker worker processed item with sequence @sequence created at @time', array(
    '@worker' => $worker,
    '@sequence' => $item->sequence,
    '@time' => date_iso8601($item->created),
  ));
}