Form submission handler for config_admin_import_form().
function config_admin_import_form_submit($form, &$form_state) {
$config_importer = new ConfigImporter($form_state['storage_comparer'], Drupal::service('event_dispatcher'), Drupal::service('config.factory'), Drupal::entityManager(), Drupal::lock());
if ($config_importer
->alreadyImporting()) {
drupal_set_message(t('Another request may be synchronizing configuration already.'));
}
else {
try {
$config_importer
->import();
drupal_flush_all_caches();
drupal_set_message(t('The configuration was imported successfully.'));
} 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.
watchdog_exception('config_import', $e);
drupal_set_message(t('The import failed due to an error. Any errors have been logged.'), 'error');
}
}
}