diff --git a/core/includes/install.core.inc b/core/includes/install.core.inc index 9365698b84..343c45507c 100644 --- a/core/includes/install.core.inc +++ b/core/includes/install.core.inc @@ -193,8 +193,10 @@ function install_state_defaults() { 'completed_task' => NULL, // Partial configuration cached during an installation from existing config. 'config' => NULL, - // The path to the configuration to install when installing from config. - 'config_install' => NULL, + // TRUE when installing from existing configuration. + 'config_install' => FALSE, + // The path to the configuration to install when installing from config. + 'profile_sync' => NULL, // TRUE when there are valid config directories. 'config_verified' => FALSE, // TRUE when there is a valid database connection. @@ -453,7 +455,7 @@ function install_begin_request($class_loader, &$install_state) { } // Use the language from profile configuration if available. - if (!empty($install_state['config_install']) && $install_state['config']['system.site']) { + if ($install_state['config_install'] && $install_state['config']['system.site']) { $install_state['parameters']['langcode'] = $install_state['config']['system.site']['default_langcode']; } else { @@ -800,7 +802,7 @@ function install_tasks($install_state) { ], ]; - if (!empty($install_state['config_install'])) { + if ($install_state['config_install']) { // The chosen profile indicates that rather than installing a new site, an // instance of the same site should be installed from the given // configuration. @@ -1498,13 +1500,21 @@ function _install_get_version_info($version) { * profile information will be added here. */ function install_load_profile(&$install_state) { + global $config_directories; + $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 (!empty($install_state['profile_info']['config_install'])) { - $install_state['config_install'] = $install_state['profile_info']['config_install']; + if ($install_state['profile_info']['config_install'] && !empty($config_directories[CONFIG_SYNC_DIRECTORY])) { + $install_state['config_install'] = TRUE; + $install_state['config']['system.site'] = \Drupal::service('config.storage.sync')->read('system.site'); + } + elseif (!empty($install_state['profile_info']['profile_sync'])) { + // If the profile has a config/sync directory copy the information to the + // install_state global. + $install_state['config_install'] = TRUE; + $install_state['profile_sync'] = $install_state['profile_info']['profile_sync']; + if (!empty($install_state['profile_info']['config'])) { $install_state['config'] = $install_state['profile_info']['config']; } @@ -2378,7 +2388,9 @@ function install_config_import_batch_finish($success, $results, $operations) { $error_operation = reset($operations); $message = t('An error occurred while processing %error_operation with arguments: @arguments', [ '%error_operation' => $error_operation[0], - '@arguments' => print_r($error_operation[1], TRUE) + // The arguments are usually added with print_r which does not handle + // circular references very well. All operations use the $config_importer. + '@arguments' => sprintf('%s::%s', get_class($error_operation[1][0]), $error_operation[1][1]) ]); drupal_set_message($message, 'error'); } diff --git a/core/includes/install.inc b/core/includes/install.inc index fb1dfd7c08..ef4a161383 100644 --- a/core/includes/install.inc +++ b/core/includes/install.inc @@ -488,14 +488,14 @@ function drupal_install_config_directories() { // If settings.php does not contain a config sync directory name we need to // configure one. if (empty($config_directories[CONFIG_SYNC_DIRECTORY])) { - if (empty($install_state['config_install'])) { + if (empty($install_state['profile_sync'])) { // Add a randomized config directory name to settings.php $config_directories[CONFIG_SYNC_DIRECTORY] = \Drupal::service('site.path') . '/files/config_' . Crypt::randomBytesBase64(55) . '/sync'; } else { // Install profiles can contain a config sync directory. If they do, - // 'config_install' is a path to the directory. - $config_directories[CONFIG_SYNC_DIRECTORY] = $install_state['config_install']; + // 'profile_sync' is a path to the directory. + $config_directories[CONFIG_SYNC_DIRECTORY] = $install_state['profile_sync']; } $settings['config_directories'][CONFIG_SYNC_DIRECTORY] = (object) [ 'value' => $config_directories[CONFIG_SYNC_DIRECTORY], @@ -1086,7 +1086,8 @@ function install_profile_info($profile, $langcode = 'en') { 'version' => NULL, 'hidden' => FALSE, 'php' => DRUPAL_MINIMUM_PHP, - 'config_install' => NULL, + 'config_install' => FALSE, + 'profile_sync' => NULL, ]; $profile_path = drupal_get_path('profile', $profile); $info = \Drupal::service('info_parser')->parse($profile_path . "/$profile.info.yml"); @@ -1102,7 +1103,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'] = $profile_path . '/config/sync'; + $info['profile_sync'] = $profile_path . '/config/sync'; $sync = new FileStorage($profile_path . '/config/sync'); $info['config']['system.site'] = $sync->read('system.site'); }