X-Git-Url: http://aleph1.co.uk/gitweb/?a=blobdiff_plain;f=web%2Fcore%2Flib%2FDrupal%2FCore%2FEventSubscriber%2FConfigImportSubscriber.php;h=c0e3a4a2c8b4009cc5a00422855c88d1b8f7930c;hb=refs%2Fheads%2Fd864;hp=e948aa584c27ca06e6d9ccd99e1d8c4165f494c8;hpb=a2bd1bf0c2c1f1a17d188f4dc0726a45494cefae;p=yaffs-website diff --git a/web/core/lib/Drupal/Core/EventSubscriber/ConfigImportSubscriber.php b/web/core/lib/Drupal/Core/EventSubscriber/ConfigImportSubscriber.php index e948aa584..c0e3a4a2c 100644 --- a/web/core/lib/Drupal/Core/EventSubscriber/ConfigImportSubscriber.php +++ b/web/core/lib/Drupal/Core/EventSubscriber/ConfigImportSubscriber.php @@ -84,6 +84,29 @@ class ConfigImportSubscriber extends ConfigImportValidateEventSubscriberBase { */ protected function validateModules(ConfigImporter $config_importer) { $core_extension = $config_importer->getStorageComparer()->getSourceStorage()->read('core.extension'); + + // Get the install profile from the site's configuration. + $current_core_extension = $config_importer->getStorageComparer()->getTargetStorage()->read('core.extension'); + $install_profile = isset($current_core_extension['profile']) ? $current_core_extension['profile'] : NULL; + + // Ensure the profile is not changing. + if ($install_profile !== $core_extension['profile']) { + if (drupal_installation_attempted()) { + $config_importer->logError($this->t('The selected installation profile %install_profile does not match the profile stored in configuration %config_profile.', [ + '%install_profile' => $install_profile, + '%config_profile' => $core_extension['profile'], + ])); + // If this error has occurred the other checks are irrelevant. + return; + } + else { + $config_importer->logError($this->t('Cannot change the install profile from %profile to %new_profile once Drupal is installed.', [ + '%profile' => $install_profile, + '%new_profile' => $core_extension['profile'], + ])); + } + } + // Get a list of modules with dependency weights as values. $module_data = $this->getModuleData(); $nonexistent_modules = array_keys(array_diff_key($core_extension['module'], $module_data)); @@ -111,10 +134,6 @@ class ConfigImportSubscriber extends ConfigImportValidateEventSubscriberBase { } } - // Get the install profile from the site's configuration. - $current_core_extension = $config_importer->getStorageComparer()->getTargetStorage()->read('core.extension'); - $install_profile = isset($current_core_extension['profile']) ? $current_core_extension['profile'] : NULL; - // Ensure that all modules being uninstalled are not required by modules // that will be installed after the import. $uninstalls = $config_importer->getExtensionChangelist('module', 'uninstall'); @@ -133,11 +152,6 @@ class ConfigImportSubscriber extends ConfigImportValidateEventSubscriberBase { $profile_name = $module_data[$install_profile]->info['name']; $config_importer->logError($this->t('Unable to uninstall the %profile profile since it is the install profile.', ['%profile' => $profile_name])); } - - // Ensure the profile is not changing. - if ($install_profile !== $core_extension['profile']) { - $config_importer->logError($this->t('Cannot change the install profile from %new_profile to %profile once Drupal is installed.', ['%profile' => $install_profile, '%new_profile' => $core_extension['profile']])); - } } /** @@ -214,19 +228,19 @@ class ConfigImportSubscriber extends ConfigImportValidateEventSubscriberBase { if (!isset($core_extension['module'][$owner]) && isset($module_data[$owner])) { $message = $this->t('Configuration %name depends on the %owner module that will not be installed after import.', [ '%name' => $name, - '%owner' => $module_data[$owner]->info['name'] + '%owner' => $module_data[$owner]->info['name'], ]); } elseif (!isset($core_extension['theme'][$owner]) && isset($theme_data[$owner])) { $message = $this->t('Configuration %name depends on the %owner theme that will not be installed after import.', [ '%name' => $name, - '%owner' => $theme_data[$owner]->info['name'] + '%owner' => $theme_data[$owner]->info['name'], ]); } elseif (!isset($core_extension['module'][$owner]) && !isset($core_extension['theme'][$owner])) { $message = $this->t('Configuration %name depends on the %owner extension that will not be installed after import.', [ '%name' => $name, - '%owner' => $owner + '%owner' => $owner, ]); }