diff --git a/core/includes/common.inc b/core/includes/common.inc index d3a4c55..7376040 100644 --- a/core/includes/common.inc +++ b/core/includes/common.inc @@ -250,7 +250,7 @@ function drupal_get_profile() { $profile = $install_state['parameters']['profile']; } else { - $profile = variable_get('install_profile', 'standard'); + $profile = config('system.site')->get('profile.install'); } return $profile; diff --git a/core/includes/install.core.inc b/core/includes/install.core.inc index c4de9ee..7eb5511 100644 --- a/core/includes/install.core.inc +++ b/core/includes/install.core.inc @@ -1834,7 +1834,7 @@ function install_import_translations_remaining(&$install_state) { function install_finished(&$install_state) { $profile = drupal_get_profile(); // Remember the profile which was used. - variable_set('install_profile', $profile); + config('system.site')->set('profile.install', $profile)->save(); // Installation profiles are always loaded last. module_set_weight($profile, 1000); diff --git a/core/includes/update.inc b/core/includes/update.inc index b39eadb..98ac5a6 100644 --- a/core/includes/update.inc +++ b/core/includes/update.inc @@ -339,6 +339,13 @@ function update_prepare_d8_bootstrap() { variable_set('language_default', (array) $language_default); } + // Moves install_profile from variable to config. You can't do that in + // system.install because _system_rebuild_module_data() needs the profile + // directly. + update_variables_to_config('system.site', array( + 'install_profile' => 'profile.install' + )); + $module_config = config('system.module'); $disabled_modules = config('system.module.disabled'); $theme_config = config('system.theme'); diff --git a/core/modules/system/config/system.site.yml b/core/modules/system/config/system.site.yml index b642dc8..0b3a700 100644 --- a/core/modules/system/config/system.site.yml +++ b/core/modules/system/config/system.site.yml @@ -7,3 +7,5 @@ page: front: user admin_compact_mode: '0' weight_select_max: '100' +profile: + install: standard 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 a4763b6..8715758 100644 --- a/core/modules/system/lib/Drupal/system/Tests/Bootstrap/GetFilenameUnitTest.php +++ b/core/modules/system/lib/Drupal/system/Tests/Bootstrap/GetFilenameUnitTest.php @@ -8,6 +8,7 @@ namespace Drupal\system\Tests\Bootstrap; use Drupal\simpletest\UnitTestBase; +use Symfony\Component\DependencyInjection\Reference; /** * Tests drupal_get_filename()'s availability. @@ -26,6 +27,17 @@ public static function getInfo() { * Tests that drupal_get_filename() works when the file is not in database. */ function testDrupalGetFilename() { + + // Setup a config factory without storage because drupal_get_profile() + // uses config. + drupal_container()->register('config.null_storage', 'Drupal\Core\Config\NullStorage'); + drupal_container()->register('config.factory', 'Drupal\Core\Config\ConfigFactory') + ->addArgument(new Reference('config.null_storage')) + ->addArgument(new Reference('event_dispatcher')); + + drupal_container()->register('event_dispatcher', 'Symfony\Component\EventDispatcher\ContainerAwareEventDispatcher') + ->addArgument(new Reference('service_container')); + // 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 d2cde1f..ec8e04f 100644 --- a/core/modules/system/lib/Drupal/system/Tests/Upgrade/SystemUpgradePathTest.php +++ b/core/modules/system/lib/Drupal/system/Tests/Upgrade/SystemUpgradePathTest.php @@ -72,6 +72,7 @@ public function testVariableUpgrade() { 'page.403' => '403', 'page.404' => '404', 'page.front' => 'node', + 'profile.install' => 'minimal', ); $expected_config['user.settings'] = array( 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 44fad9f..27b82ee 100644 --- a/core/modules/system/tests/upgrade/drupal-7.system.database.php +++ b/core/modules/system/tests/upgrade/drupal-7.system.database.php @@ -195,3 +195,7 @@ 'value' => serialize('public://color/seven-09696463/dummy-screenshot.png'), )) ->execute(); +db_update('variable') + ->fields(array('value' => 's:7:"minimal";')) + ->condition('name', 'install_profile') + ->execute();