function _drush_config_import

8.0.x config.drush.inc _drush_config_import(StorageComparer $storage_comparer)
7.x config.drush.inc _drush_config_import(StorageComparer $storage_comparer)
master config.drush.inc _drush_config_import(StorageComparer $storage_comparer)
1 string reference to '_drush_config_import'
drush_config_import in commands/core/config.drush.inc
Command callback. Import from specified config directory (defaults to sync).

File

commands/core/config.drush.inc, line 646
Provides Configuration Management commands.

Code

function _drush_config_import(StorageComparer $storage_comparer) {
  $config_importer = new ConfigImporter($storage_comparer, Drupal::service('event_dispatcher'), Drupal::service('config.manager'), Drupal::lock(), Drupal::service('config.typed'), Drupal::moduleHandler(), Drupal::service('module_installer'), Drupal::service('theme_handler'), Drupal::service('string_translation'));
  if ($config_importer->alreadyImporting()) {
    drush_log('Another request may be synchronizing configuration already.', LogLevel::WARNING);
  }
  else {
    try {
      $config_importer->import();
      drush_drupal_cache_clear_all();
      drush_log('The configuration was imported successfully.', LogLevel::SUCCESS);
    }
    catch (ConfigException $e) {
      // Return a negative result for UI purposes. We do not differentiate
      // between an actual synchronization error and a failed lock, because
      // concurrent synchronizations are an edge-case happening only when
      // multiple developers or site builders attempt to do it without
      // coordinating.
      $message = 'The import failed due for the following reasons:' . "\n";
      $message .= implode("\n", $config_importer->getErrors());

      watchdog_exception('config_import', $e);
      return drush_set_error('config_import_fail', $message);
    }
  }
}