diff --git a/core/includes/install.core.inc b/core/includes/install.core.inc index 7657edc..721d106 100644 --- a/core/includes/install.core.inc +++ b/core/includes/install.core.inc @@ -450,8 +450,8 @@ function install_begin_request($class_loader, &$install_state) { } // Use the language from profile configuration if available. - if (!empty($install_state['profile_info']['config_install'])) { - $install_state['parameters']['langcode'] = $install_state['profile_info']['config']['system.site']['default_langcode']; + if (!empty($install_state['config_install'])) { + $install_state['parameters']['langcode'] = $install_state['config']['system.site']['default_langcode']; } else { // Otherwise, Use the language from the profile configuration, if available, @@ -799,7 +799,7 @@ function install_tasks($install_state) { // Now add any tasks defined by the installation profile. if (!empty($install_state['parameters']['profile'])) { - if ($install_state['profile_info']['config_install']) { + if ($install_state['config_install']) { // @todo add a load of commentary about what is happening. unset($tasks['install_download_translation']); $key = array_search('install_profile_modules', array_keys($tasks), TRUE); @@ -1493,6 +1493,12 @@ function install_load_profile(&$install_state) { $profile = $install_state['parameters']['profile']; $install_state['profiles'][$profile]->load(); $install_state['profile_info'] = install_profile_info($profile, isset($install_state['parameters']['langcode']) ? $install_state['parameters']['langcode'] : 'en'); + // If the profile has a config/sync directory copy the information to the + // install_state global. + if (isset($install_state['profile_info']['config_install'])) { + $install_state['config_install'] = $install_state['profile_info']['config_install']; + $install_state['config'] = $install_state['profile_info']['config']; + } } /** diff --git a/core/includes/install.inc b/core/includes/install.inc index 7aab7a1..672815c 100644 --- a/core/includes/install.inc +++ b/core/includes/install.inc @@ -488,9 +488,9 @@ function drupal_install_config_directories() { // Add a randomized config directory name to settings.php, unless it was // manually defined in the existing already. if (empty($config_directories[CONFIG_SYNC_DIRECTORY])) { - if ($install_state['profile_info']['config_install']) { + if ($install_state['config_install']) { $profile = $install_state['parameters']['profile']; - $config_directories[CONFIG_SYNC_DIRECTORY] = $install_state['profiles'][$profile]->getPath() . '/config/sync'; + $config_directories[CONFIG_SYNC_DIRECTORY] = $install_state['config_install']; } else { $config_directories[CONFIG_SYNC_DIRECTORY] = \Drupal::service('site.path') . '/files/config_' . Crypt::randomBytesBase64(55) . '/sync'; @@ -1100,7 +1100,7 @@ function install_profile_info($profile, $langcode = 'en') { // If the profile has a config/sync directory use that to install drupal. if (is_dir($profile_path . '/config/sync')) { - $info['config_install'] = TRUE; + $info['config_install'] = $profile_path . '/config/sync'; $sync = new FileStorage($profile_path . '/config/sync'); $info['config']['system.site'] = $sync->read('system.site'); } diff --git a/core/lib/Drupal/Core/Installer/Form/SiteConfigureForm.php b/core/lib/Drupal/Core/Installer/Form/SiteConfigureForm.php index f369b9b..6f9ddca 100644 --- a/core/lib/Drupal/Core/Installer/Form/SiteConfigureForm.php +++ b/core/lib/Drupal/Core/Installer/Form/SiteConfigureForm.php @@ -146,14 +146,14 @@ public function buildForm(array $form, FormStateInterface $form_state) { $form['site_information'] = [ '#type' => 'fieldgroup', '#title' => $this->t('Site information'), - '#access' => !$install_state['profile_info']['config_install'], + '#access' => !empty($install_state['config_install']), ]; $form['site_information']['site_name'] = [ '#type' => 'textfield', '#title' => $this->t('Site name'), '#required' => TRUE, '#weight' => -20, - '#access' => !$install_state['profile_info']['config_install'], + '#access' => !empty($install_state['config_install']), ]; $form['site_information']['site_mail'] = [ '#type' => 'email', @@ -162,7 +162,7 @@ public function buildForm(array $form, FormStateInterface $form_state) { '#description' => $this->t("Automated emails, such as registration information, will be sent from this address. Use an address ending in your site's domain to help prevent these emails from being flagged as spam."), '#required' => TRUE, '#weight' => -15, - '#access' => !$install_state['profile_info']['config_install'], + '#access' => !empty($install_state['config_install']), ]; $form['admin_account'] = [ @@ -192,7 +192,7 @@ public function buildForm(array $form, FormStateInterface $form_state) { $form['regional_settings'] = [ '#type' => 'fieldgroup', '#title' => $this->t('Regional settings'), - '#access' => !$install_state['profile_info']['config_install'], + '#access' => !empty($install_state['config_install']), ]; $countries = $this->countryManager->getList(); $form['regional_settings']['site_default_country'] = [ @@ -203,7 +203,7 @@ public function buildForm(array $form, FormStateInterface $form_state) { '#options' => $countries, '#description' => $this->t('Select the default country for the site.'), '#weight' => 0, - '#access' => !$install_state['profile_info']['config_install'], + '#access' => !empty($install_state['config_install']), ]; $form['regional_settings']['date_default_timezone'] = [ '#type' => 'select', @@ -214,20 +214,20 @@ public function buildForm(array $form, FormStateInterface $form_state) { '#description' => $this->t('By default, dates in this site will be displayed in the chosen time zone.'), '#weight' => 5, '#attributes' => ['class' => ['timezone-detect']], - '#access' => !$install_state['profile_info']['config_install'], + '#access' => !empty($install_state['config_install']), ]; $form['update_notifications'] = [ '#type' => 'fieldgroup', '#title' => $this->t('Update notifications'), '#description' => $this->t('The system will notify you when updates and important security releases are available for installed components. Anonymous information about your site is sent to Drupal.org.', [':drupal' => 'https://www.drupal.org']), - '#access' => !$install_state['profile_info']['config_install'], + '#access' => !empty($install_state['config_install']), ]; $form['update_notifications']['enable_update_status_module'] = [ '#type' => 'checkbox', '#title' => $this->t('Check for updates automatically'), '#default_value' => 1, - '#access' => !$install_state['profile_info']['config_install'], + '#access' => !empty($install_state['config_install']), ]; $form['update_notifications']['enable_update_status_emails'] = [ '#type' => 'checkbox', @@ -238,7 +238,7 @@ public function buildForm(array $form, FormStateInterface $form_state) { 'input[name="enable_update_status_module"]' => ['checked' => TRUE], ], ], - '#access' => !$install_state['profile_info']['config_install'], + '#access' => !empty($install_state['config_install']), ]; $form['actions'] = ['#type' => 'actions']; @@ -267,7 +267,7 @@ public function validateForm(array &$form, FormStateInterface $form_state) { public function submitForm(array &$form, FormStateInterface $form_state) { global $install_state; - if (!$install_state['profile_info']['config_install']) { + if (!empty($install_state['config_install'])) { $this->config('system.site') ->set('name', (string) $form_state->getValue('site_name')) ->set('mail', (string) $form_state->getValue('site_mail')) @@ -283,7 +283,7 @@ public function submitForm(array &$form, FormStateInterface $form_state) { // Enable update.module if this option was selected. $update_status_module = $form_state->getValue('enable_update_status_module'); - if (!$install_state['profile_info']['config_install'] && $update_status_module) { + if (!empty($install_state['config_install']) && $update_status_module) { $this->moduleInstaller->install(['file', 'update'], FALSE); // Add the site maintenance account's email address to the list of