You are here

function l10n_update_batch_status_finished in Localization update 7.2

Batch finished callback: Set result message.

Parameters

bool $success: TRUE if batch successfully completed.

array $results: Batch results.

1 string reference to 'l10n_update_batch_status_finished'
l10n_update_batch_status_build in ./l10n_update.compare.inc
Builds a batch to get the status of remote and local translation files.

File

./l10n_update.batch.inc, line 92
Batch process to check the availability of remote or local po files.

Code

function l10n_update_batch_status_finished($success, array $results) {
  if ($success) {
    if (isset($results['failed_files'])) {
      if (module_exists('dblog')) {
        $message = format_plural(count($results['failed_files']), 'One translation file could not be checked. <a href="@url">See the log</a> for details.', '@count translation files could not be checked. <a href="@url">See the log</a> for details.', array(
          '@url' => url('admin/reports/dblog'),
        ));
      }
      else {
        $message = format_plural(count($results['failed_files']), 'One translation files could not be checked. See the log for details.', '@count translation files could not be checked. See the log for details.');
      }
      drupal_set_message($message, 'error');
    }
    if (isset($results['files'])) {
      drupal_set_message(format_plural(count($results['files']), 'Checked available interface translation updates for one project.', 'Checked available interface translation updates for @count projects.'));
    }
    if (!isset($results['failed_files']) && !isset($results['files'])) {
      drupal_set_message(t('Nothing to check.'));
    }
    variable_set('l10n_update_last_check', REQUEST_TIME);
  }
  else {
    drupal_set_message(t('An error occurred trying to check available interface translation updates.'), 'error');
  }
}