diff --git a/core/includes/common.inc b/core/includes/common.inc index bb14e95..bafedf4 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 755c2c1..c886f0b 100644 --- a/core/includes/install.core.inc +++ b/core/includes/install.core.inc @@ -1679,7 +1679,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/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 27ea1d7..b3648b3 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 ea6d6aa..090a020 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/system.install b/core/modules/system/system.install index 8c7d72a..3684455 100644 --- a/core/modules/system/system.install +++ b/core/modules/system/system.install @@ -2326,6 +2326,17 @@ function system_update_8045() { } /** + * Moves install_profile from variable to config. + * + * @ingroup config_upgrade + */ +function system_update_8046() { + update_variables_to_config('system.site', array( + 'install_profile' => 'profile.install' + )); +} + +/** * @} End of "defgroup updates-7.x-to-8.x". * The next series of updates should start at 9000. */ 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 061540b..4647fe0 100644 --- a/core/modules/system/tests/upgrade/drupal-7.system.database.php +++ b/core/modules/system/tests/upgrade/drupal-7.system.database.php @@ -133,3 +133,7 @@ ->fields(array('value' => 's:10:"plain_text";')) ->condition('name', 'filter_fallback_format') ->execute(); +db_update('variable') + ->fields(array('value' => 's:7:"minimal";')) + ->condition('name', 'install_profile') + ->execute();