batch_example_finished

Definition

batch_example_finished($success, $results, $operations)
developer/examples/batch_example.module, line 244

Description

Batch 'finished' callback used by both batch 1 and batch 2

Related topics

Namesort iconDescription
Example batch definitionsDefinitions of the batches used in this module.

Code

<?php
function batch_example_finished($success, $results, $operations) {
  if ($success) {
    // Here we could do something meaningful with the results.
    // We just display the number of nodes we processed...
    $message = count($results) . ' processed.';
  }
  else {
    // An error occurred.
    // $operations contains the operations that remained unprocessed.
    $error_operation = reset($operations);
    $message = 'An error occurred while processing ' . $error_operation[0] . ' with arguments :' . print_r($error_operation[0], TRUE);
  }
  drupal_set_message($message);
}
?>
 
 

All source code and documentation on this site is released under the terms of the GNU General Public License, version 2 and later. Drupal is a registered trademark of Dries Buytaert.