+
+ // 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'],
+ ]));
+ }
+ }
+