diff -u b/core/includes/install.core.inc b/core/includes/install.core.inc --- b/core/includes/install.core.inc +++ b/core/includes/install.core.inc @@ -8,7 +8,6 @@ use Drupal\Component\Utility\UrlHelper; use Drupal\Core\Config\ConfigImporter; use Drupal\Core\Config\ConfigImporterException; -use Drupal\Core\Config\FileStorage; use Drupal\Core\Config\StorageComparer; use Drupal\Core\DrupalKernel; use Drupal\Core\Database\Database; @@ -450,7 +449,7 @@ } // Use the language from profile configuration if available. - if (!empty($install_state['config_install'])) { + if (!empty($install_state['config_install']) && $install_state['config']['system.site']) { $install_state['parameters']['langcode'] = $install_state['config']['system.site']['default_langcode']; } else { @@ -2260,14 +2259,13 @@ * @see install_tasks() */ function install_config_import_batch() { - global $config_directories; // We need to manually trigger the installation of core-provided entity types, // as those will not be handled by the module installer. // @see install_profile_modules() install_core_entity_type_definitions(); - // Create a source storage that reads from sync. - $sync = new FileStorage($config_directories[CONFIG_SYNC_DIRECTORY]); + // Get the sync storage. + $sync = \Drupal::service('config.storage.sync'); // Match up the site uuids, the install_base_system install task will have // installed the system module and created a new UUID. $system_site = $sync->read('system.site'); @@ -2308,11 +2306,13 @@ return $batch; } catch (ConfigImporterException $e) { + global $install_state; // There are validation errors. - drupal_set_message(t('The configuration synchronization failed validation.')); + drupal_set_message(t('The configuration synchronization failed validation.'), 'error'); foreach ($config_importer->getErrors() as $message) { drupal_set_message($message, 'error'); } + install_display_output(['#title' => t('Configuration validation')], $install_state); } } @@ -2421,11 +2421,13 @@ $config_importer->import(); } catch (ConfigImporterException $e) { + global $install_state; // There are validation errors. - drupal_set_message(t('The configuration synchronization failed validation.')); + drupal_set_message(t('The configuration synchronization failed validation.'), 'error'); foreach ($config_importer->getErrors() as $message) { drupal_set_message($message, 'error'); } + install_display_output(['#title' => t('Configuration validation')], $install_state); } // At this point the configuration should match completely. diff -u b/core/modules/system/src/Tests/Installer/InstallerExistingConfigTestBase.php b/core/modules/system/src/Tests/Installer/InstallerExistingConfigTestBase.php --- b/core/modules/system/src/Tests/Installer/InstallerExistingConfigTestBase.php +++ b/core/modules/system/src/Tests/Installer/InstallerExistingConfigTestBase.php @@ -22,19 +22,21 @@ protected function setUp() { $archiver = new ArchiveTar($this->getConfigTarball(), 'gz'); - $core_extension = Yaml::decode($archiver->extractInString('core.extension.yml')); - $this->profile = $core_extension['profile']; + if ($this->profile === NULL) { + $core_extension = Yaml::decode($archiver->extractInString('core.extension.yml')); + $this->profile = $core_extension['profile']; + } // Create a profile for testing. $info = [ 'type' => 'profile', 'core' => \Drupal::CORE_COMPATIBILITY, - 'name' => 'Configuration installation test profile (' . $core_extension['profile'] . ')', + 'name' => 'Configuration installation test profile (' . $this->profile . ')', ]; // File API functions are not available yet. - $path = $this->siteDirectory . '/profiles/' . $core_extension['profile']; + $path = $this->siteDirectory . '/profiles/' . $this->profile; mkdir($path, 0777, TRUE); - file_put_contents("$path/{$core_extension['profile']}.info.yml", Yaml::encode($info)); + file_put_contents("$path/{$this->profile}.info.yml", Yaml::encode($info)); // Create config/sync directory and extract tarball contents to it. $config_sync_directory = $path . '/config/sync'; @@ -46,8 +48,8 @@ foreach ($list as $file) { $files[] = $file['filename']; } + $archiver->extractList($files, $config_sync_directory); } - $archiver->extractList($files, $config_sync_directory); parent::setUp(); } only in patch2: unchanged: --- /dev/null +++ b/core/modules/system/src/Tests/Installer/InstallerExistingConfigNoConfigTest.php @@ -0,0 +1,39 @@ +assertTitle('Configuration validation | Drupal'); + $this->assertText('The configuration synchronization failed validation.'); + $this->assertText('This import is empty and if applied would delete all of your configuration, so has been rejected.'); + + // Ensure there is no continuation button. + $this->assertNoText('Save and continue'); + $this->assertNoFieldById('edit-submit'); + } + +} only in patch2: unchanged: --- /dev/null +++ b/core/modules/system/tests/fixtures/config_install/testing_config_install_no_config.tar.gz @@ -0,0 +1 @@ + \ No newline at end of file