*/
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));
}
}
- // 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');
$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 %profile to %new_profile once Drupal is installed.', ['%profile' => $install_profile, '%new_profile' => $core_extension['profile']]));
- }
}
/**
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,
]);
}