You are here

function la_batch_finished in Location 7.3

Batch finished callback.

Parameters

bool $success: TRUE if success.

array $results: Array of results.

$operations: List of operations that remained unprocessed.

1 string reference to 'la_batch_finished'
la_batch_run in contrib/location_autofill/la.module
Helper function for batch creation.

File

contrib/location_autofill/la.module, line 164
Location autofill routines.

Code

function la_batch_finished($success, $results, $operations) {
  if ($success) {
    $counts = array_count_values($results);

    // Here we could do something meaningful with the results.
    // We just display the number of nodes we processed...
    $cresults = count($results);
    $csuccess = count($counts);
    $cerrors = $counts['error'];
    drupal_set_message(t('@count locations processed in @requests HTTP requests with @errors errors.', array(
      '@count' => $cresults,
      '@requests' => la_get_http_requests(),
      '@errors' => $cerrors,
    )));
  }
  else {

    // An error occurred.
    // $operations contains the operations that remained unprocessed.
    $error_operation = reset($operations);
    drupal_set_message(t('An error occurred while processing @operation with arguments : @args', array(
      '@operation' => $error_operation[0],
      '@args' => print_r($error_operation[0], TRUE),
    )));
  }
}