You are here

function pathauto_bulk_update_batch_finished in Pathauto 6.2

Same name and namespace in other branches
  1. 7 pathauto.admin.inc \pathauto_bulk_update_batch_finished()

Batch finished callback.

1 string reference to 'pathauto_bulk_update_batch_finished'
pathauto_bulk_update_form_submit in ./pathauto.admin.inc
Form submit handler for path alias bulk update form.

File

./pathauto.admin.inc, line 398
Admin page callbacks for the Pathauto module.

Code

function pathauto_bulk_update_batch_finished($success, $results, $operations) {
  if ($success) {

    // Count the current number of URL aliases after the batch is completed
    // and compare to the count before the batch started.
    $results['count_after'] = db_result(db_query("SELECT COUNT(*) FROM {url_alias}"));
    $results['count_changed'] = max($results['count_after'] - $results['count_before'], 0);
    if ($results['count_changed']) {
      drupal_set_message(format_plural($results['count_changed'], 'Generated 1 URL alias.', 'Generated @count URL aliases.'));
    }
    else {
      drupal_set_message(t('No new URL aliases to generate.'));
    }
  }
  else {
    $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),
    )));
  }
}