count; } else { $context['results'][$nid] = $deleted_revisions->count; } // Evaluate if we are done with the current node. if (empty($deleted_revisions->pending)) { $context['sandbox']['current']++; } // Inform the batch engine that we are not finished, // and provide an estimation of the completion level we reached. $context['finished'] = empty($context['sandbox']['nids']) ? 1 : $context['sandbox']['current'] / $context['sandbox']['total']; } /** * Batch 'finished' callback. */ function node_revision_delete_batch_finish($success, $results, $operations) { if ($success) { foreach ($results as $nid => $count) { drupal_set_message(t('Deleted @count revisions for node with nid @nid.', array( '@count' => $count, '@nid' => $nid, ))); } } else { // An error occurred. // $operations contains the operations that remained unprocessed. $error_operation = reset($operations); $message_variables = array( '%error_operation' => $error_operation[0], '@arguments' => print_r($error_operation[1], TRUE), ); $message = t('An error occurred while processing %error_operation with arguments: @arguments', $message_variables, TRUE); drupal_set_message($message, 'error'); } }