You are here

function _views_bulk_operations_batch_finished in Views Bulk Operations (VBO) 6.3

Helper function to cleanup Batch API operations.

1 call to _views_bulk_operations_batch_finished()
_views_bulk_operations_direct_finished in ./views_bulk_operations.module
Helper function to cleanup direct execution operations.
1 string reference to '_views_bulk_operations_batch_finished'
_views_bulk_operations_execute in ./views_bulk_operations.module
Helper function to execute the chosen action upon selected objects.

File

./views_bulk_operations.module, line 701
Allows operations to be performed on items selected in a view.

Code

function _views_bulk_operations_batch_finished($success, $results, $operations, $display_result = NULL) {
  if ($success) {
    if ($results['rows'] > 0) {
      $message = t('!results rows processed in about !time ms:', array(
        '!results' => $results['rows'],
        '!time' => round((microtime(TRUE) - $results['time']) * 1000),
      ));
    }
    else {
      $message = t('No rows were processed:');
    }
    $message .= "\n" . theme('item_list', $results['log']);
  }
  else {

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

    // See http://cvs.drupal.org/viewvc.py/drupal/drupal/includes/actions.inc?view=log&pathrev=DRUPAL-6-10
    variable_set('actions_max_stack', 35);
  }
  if ($display_result || @$_SESSION['vbo_options']['display_result']) {
    _views_bulk_operations_log($message);
  }
  unset($_SESSION['vbo_options']);

  // unset the options which were used for just one invocation
}