You are here

function node_revision_delete_batch_delete_prior_revisions_finished in Node Revision Delete 7.3

Finishing bulk operations for prior revision deletion.

Parameters

bool $success: A boolean indicating the operations success.

array $results: The results variables.

array $operations: The operations.

1 string reference to 'node_revision_delete_batch_delete_prior_revisions_finished'
_node_revision_delete_delete_batch_op in ./node_revision_delete.module
Batch operation definition: deleting prior revisions.

File

./node_revision_delete.batch.inc, line 122
Batch API callbacks for node_revision_delete module.

Code

function node_revision_delete_batch_delete_prior_revisions_finished($success, array $results, array $operations) {
  if ($success) {
    $message = format_plural($results['revisions'], 'One prior revision deleted.', '@count prior revisions deleted.');
    drupal_set_message($message);

    // Getting the node.
    $node = node_load($results['node']);

    // Get all revisions of the current node.
    $revision_ids = node_revision_list($node);

    // In case there are no more revisions, we should be redirected to the node
    // view as the node revision page does not exist.
    if (count($revision_ids) == 1) {
      drupal_goto('node/' . $results['node']);
    }
  }
  else {
    $error_operation = reset($operations);
    drupal_set_message(t('An error occurred while processing @operation with arguments: @args', [
      '@operation' => $error_operation[0],
      '@args' => print_r($error_operation[0], TRUE),
    ]));
  }
}