diff --git a/core/includes/common.inc b/core/includes/common.inc index dfd20fa..48f0060 100644 --- a/core/includes/common.inc +++ b/core/includes/common.inc @@ -268,11 +268,17 @@ function drupal_get_region_content($region = NULL, $delimiter = ' ') { function drupal_get_profile() { global $install_state; - if (isset($install_state['parameters']['profile'])) { - $profile = $install_state['parameters']['profile']; + if (defined('MAINTENANCE_MODE') && (MAINTENANCE_MODE == 'install')) { + // If the profile has been selected return it. + if (isset($install_state['parameters']['profile'])) { + $profile = $install_state['parameters']['profile']; + } + else { + $profile = ''; + } } else { - $profile = variable_get('install_profile', 'standard'); + $profile = Drupal::state()->get('profile.install') ?: 'standard'; } return $profile; diff --git a/core/includes/install.core.inc b/core/includes/install.core.inc index eefe926..2c310a1 100644 --- a/core/includes/install.core.inc +++ b/core/includes/install.core.inc @@ -1985,7 +1985,7 @@ function install_update_configuration_translations(&$install_state) { function install_finished(&$install_state) { $profile = drupal_get_profile(); // Remember the profile which was used. - variable_set('install_profile', $profile); + Drupal::state()->set('profile.install', $profile); // Installation profiles are always loaded last. module_set_weight($profile, 1000); diff --git a/core/includes/update.inc b/core/includes/update.inc index cf25b03..4a60149 100644 --- a/core/includes/update.inc +++ b/core/includes/update.inc @@ -331,6 +331,12 @@ function update_prepare_d8_bootstrap() { variable_set('language_default', (array) $language_default); } + // Moves install_profile from variable to state. You can't do that in + // system.install because _system_rebuild_module_data() needs the profile + // directly. + $old_variable = unserialize(Drupal::database()->query('SELECT value FROM {variable} WHERE name = :name', array(':name' => 'install_profile'))->fetchField()); + Drupal::state()->set('profile.install', $old_variable); + $module_config = config('system.module'); $disabled_modules = config('system.module.disabled'); $theme_config = config('system.theme'); diff --git a/core/modules/system/lib/Drupal/system/Tests/Bootstrap/GetFilenameUnitTest.php b/core/modules/system/lib/Drupal/system/Tests/Bootstrap/GetFilenameUnitTest.php index d2d4cc7..c939630 100644 --- a/core/modules/system/lib/Drupal/system/Tests/Bootstrap/GetFilenameUnitTest.php +++ b/core/modules/system/lib/Drupal/system/Tests/Bootstrap/GetFilenameUnitTest.php @@ -26,6 +26,11 @@ public static function getInfo() { * Tests that drupal_get_filename() works when the file is not in database. */ function testDrupalGetFilename() { + // drupal_get_profile() is using obtaining the profile from state if the + // install_state global is not set. + global $install_state; + $install_state['parameters']['profile'] = 'testing'; + // Assert that the test is meaningful by making sure the keyvalue service // does not exist. $this->assertFalse(drupal_container()->has('keyvalue'), 'The container has no keyvalue service.'); diff --git a/core/modules/system/lib/Drupal/system/Tests/Upgrade/SystemUpgradePathTest.php b/core/modules/system/lib/Drupal/system/Tests/Upgrade/SystemUpgradePathTest.php index 67ec268..c17e186 100644 --- a/core/modules/system/lib/Drupal/system/Tests/Upgrade/SystemUpgradePathTest.php +++ b/core/modules/system/lib/Drupal/system/Tests/Upgrade/SystemUpgradePathTest.php @@ -80,6 +80,10 @@ public function testVariableUpgrade() { 'page.front' => 'node', ); + // The upgrade path converts "install_profile" to the state key + // "profile.install". + $this->assertEqual('minimal', $this->container->get('state')->get('profile.install')); + $expected_config['user.settings'] = array( 'cancel_method' => 'user_cancel_reassign', ); diff --git a/core/modules/system/tests/upgrade/drupal-7.system.database.php b/core/modules/system/tests/upgrade/drupal-7.system.database.php index beebe4e..f15d406 100644 --- a/core/modules/system/tests/upgrade/drupal-7.system.database.php +++ b/core/modules/system/tests/upgrade/drupal-7.system.database.php @@ -243,3 +243,8 @@ 'value' => serialize('public://color/seven-09696463/dummy-screenshot.png'), )) ->execute(); + +db_update('variable') + ->fields(array('value' => 's:7:"minimal";')) + ->condition('name', 'install_profile') + ->execute();