You are here

function config_install_batch_finish in Configuration installer 8

Finish config importer batch.

See also

config_install_batch()

1 string reference to 'config_install_batch_finish'
config_install_batch in ./config_installer.profile
Creates a batch for the config importer to process.

File

./config_installer.profile, line 154
Enables modules and site configuration for a minimal site installation.

Code

function config_install_batch_finish($success, $results, $operations) {
  if ($success) {
    if (!empty($results['errors'])) {
      foreach ($results['errors'] as $error) {
        drupal_set_message($error, 'error');
        \Drupal::logger('config_sync')
          ->error($error);
      }
      drupal_set_message(\Drupal::translation()
        ->translate('The configuration was imported with errors.'), 'warning');
    }
    else {

      // Configuration sync needs a complete cache flush.
      drupal_flush_all_caches();
    }
  }
  else {

    // An error occurred.
    // $operations contains the operations that remained unprocessed.
    $error_operation = reset($operations);
    $message = \Drupal::translation()
      ->translate('An error occurred while processing %error_operation with arguments: @arguments', [
      '%error_operation' => $error_operation[0],
      '@arguments' => print_r($error_operation[1], TRUE),
    ]);
    drupal_set_message($message, 'error');
  }
}