summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNathaniel Catchpole2018-06-25 19:12:22 (GMT)
committerNathaniel Catchpole2018-06-25 19:12:22 (GMT)
commit16726375965ae2dddc600582467cc8fc55b67486 (patch)
treefd0e64855d95760a369a8fe66541768560269e43
parent646584b3f718897179589f4f014531e3d9365331 (diff)
Issue #2975328 by alexpott, Gábor Hojtsy, borisson_: Install profile in settings.php and mismatch check makes re-installs of Drupal hard
-rw-r--r--core/includes/bootstrap.inc7
-rw-r--r--core/includes/install.core.inc14
-rw-r--r--core/lib/Drupal/Core/DrupalKernel.php5
-rw-r--r--core/lib/Drupal/Core/Installer/Exception/InstallProfileMismatchException.php2
-rw-r--r--core/lib/Drupal/Core/Installer/Form/SiteSettingsForm.php5
-rw-r--r--core/lib/Drupal/Core/Site/Settings.php3
-rw-r--r--core/modules/system/system.install15
-rw-r--r--core/modules/system/tests/src/Functional/Update/InstallProfileSystemInstall8300Test.php3
-rw-r--r--core/modules/system/tests/src/Kernel/Extension/ModuleHandlerTest.php6
-rw-r--r--core/profiles/demo_umami/modules/demo_umami_content/tests/src/Functional/DefaultContentFilesAccessTest.php3
-rw-r--r--core/tests/Drupal/FunctionalTests/Installer/DistributionProfileExistingSettingsTest.php2
-rw-r--r--core/tests/Drupal/FunctionalTests/Installer/DistributionProfileTest.php2
-rw-r--r--core/tests/Drupal/FunctionalTests/Installer/InstallerExistingSettingsMismatchProfileTest.php5
-rw-r--r--core/tests/Drupal/FunctionalTests/Installer/InstallerExistingSettingsReadOnlyMismatchProfileTest.php (renamed from core/tests/Drupal/FunctionalTests/Installer/InstallerExistingSettingsMismatchProfileBrokenTest.php)22
-rw-r--r--core/tests/Drupal/FunctionalTests/Installer/InstallerExistingSettingsTest.php11
-rw-r--r--core/tests/Drupal/FunctionalTests/Installer/MultipleDistributionsProfileTest.php2
-rw-r--r--core/tests/Drupal/KernelTests/Core/Extension/ModuleExtensionListTest.php6
-rw-r--r--core/tests/Drupal/KernelTests/KernelTestBase.php21
-rw-r--r--sites/default/default.settings.php17
19 files changed, 76 insertions, 75 deletions
diff --git a/core/includes/bootstrap.inc b/core/includes/bootstrap.inc
index c2aeb55..45c9490 100644
--- a/core/includes/bootstrap.inc
+++ b/core/includes/bootstrap.inc
@@ -14,7 +14,6 @@ use Drupal\Core\Extension\Exception\UnknownExtensionException;
use Drupal\Core\Logger\RfcLogLevel;
use Drupal\Core\Test\TestDatabase;
use Drupal\Core\Session\AccountInterface;
-use Drupal\Core\Site\Settings;
use Drupal\Core\Utility\Error;
use Drupal\Core\StringTranslation\TranslatableMarkup;
@@ -797,12 +796,6 @@ function drupal_get_profile() {
else {
$profile = BootstrapConfigStorageFactory::getDatabaseStorage()->read('core.extension')['profile'];
}
-
- // A BC layer just in in case this only exists in Settings. Introduced in
- // Drupal 8.3.x and will be removed before Drupal 9.0.0.
- if (empty($profile)) {
- $profile = Settings::get('install_profile');
- }
}
return $profile;
diff --git a/core/includes/install.core.inc b/core/includes/install.core.inc
index f2a5a6a..39c809f 100644
--- a/core/includes/install.core.inc
+++ b/core/includes/install.core.inc
@@ -17,7 +17,6 @@ use Drupal\Core\Database\DatabaseExceptionWrapper;
use Drupal\Core\Form\FormState;
use Drupal\Core\Installer\Exception\AlreadyInstalledException;
use Drupal\Core\Installer\Exception\InstallerException;
-use Drupal\Core\Installer\Exception\InstallProfileMismatchException;
use Drupal\Core\Installer\Exception\NoProfilesException;
use Drupal\Core\Installer\InstallerKernel;
use Drupal\Core\Language\Language;
@@ -2284,16 +2283,16 @@ function install_display_requirements($install_state, $requirements) {
*
* @see _install_select_profile()
*
- * @throws \Drupal\Core\Installer\Exception\InstallProfileMismatchException
- *
* @deprecated in Drupal 8.3.0 and will be removed before Drupal 9.0.0. The
* install profile is written to core.extension.
*/
function install_write_profile($install_state) {
- // Only need to write to settings.php if it is possible. The primary storage
- // for the install profile is the core.extension configuration.
+ // Only write the install profile to settings.php if already exists. The value
+ // from settings.php is never used but drupal_rewrite_settings() does not
+ // support removing a setting. If the value in configuration and settings.php
+ // don't match there will be a warning on the status report.
$settings_path = \Drupal::service('site.path') . '/settings.php';
- if (is_writable($settings_path)) {
+ if (is_writable($settings_path) && array_key_exists('install_profile', Settings::getAll())) {
// Remember the profile which was used.
$settings['settings']['install_profile'] = (object) [
'value' => $install_state['parameters']['profile'],
@@ -2301,9 +2300,6 @@ function install_write_profile($install_state) {
];
drupal_rewrite_settings($settings);
}
- elseif (($settings_profile = Settings::get('install_profile')) && $settings_profile !== $install_state['parameters']['profile']) {
- throw new InstallProfileMismatchException($install_state['parameters']['profile'], $settings_profile, $settings_path, \Drupal::translation());
- }
}
/**
diff --git a/core/lib/Drupal/Core/DrupalKernel.php b/core/lib/Drupal/Core/DrupalKernel.php
index 8de7a46..73022a5 100644
--- a/core/lib/Drupal/Core/DrupalKernel.php
+++ b/core/lib/Drupal/Core/DrupalKernel.php
@@ -1604,13 +1604,14 @@ class DrupalKernel implements DrupalKernelInterface, TerminableInterface {
*/
protected function getInstallProfile() {
$config = $this->getConfigStorage()->read('core.extension');
- if (!empty($config['profile'])) {
+ if (isset($config['profile'])) {
$install_profile = $config['profile'];
}
// @todo https://www.drupal.org/node/2831065 remove the BC layer.
else {
// If system_update_8300() has not yet run fallback to using settings.
- $install_profile = Settings::get('install_profile');
+ $settings = Settings::getAll();
+ $install_profile = isset($settings['install_profile']) ? $settings['install_profile'] : NULL;
}
// Normalize an empty string to a NULL value.
diff --git a/core/lib/Drupal/Core/Installer/Exception/InstallProfileMismatchException.php b/core/lib/Drupal/Core/Installer/Exception/InstallProfileMismatchException.php
index d679789..7717b09 100644
--- a/core/lib/Drupal/Core/Installer/Exception/InstallProfileMismatchException.php
+++ b/core/lib/Drupal/Core/Installer/Exception/InstallProfileMismatchException.php
@@ -4,6 +4,8 @@ namespace Drupal\Core\Installer\Exception;
use Drupal\Core\StringTranslation\TranslationInterface;
+@trigger_error(__NAMESPACE__ . '/InstallProfileMismatchException is deprecated in Drupal 8.6.0 and will be removed before Drupal 9. See https://www.drupal.org/node/2538996', E_USER_DEPRECATED);
+
/**
* Exception thrown if settings.php cannot be written and the chosen profile does not match.
*/
diff --git a/core/lib/Drupal/Core/Installer/Form/SiteSettingsForm.php b/core/lib/Drupal/Core/Installer/Form/SiteSettingsForm.php
index 651e9f5..a0b576e 100644
--- a/core/lib/Drupal/Core/Installer/Form/SiteSettingsForm.php
+++ b/core/lib/Drupal/Core/Installer/Form/SiteSettingsForm.php
@@ -225,11 +225,6 @@ class SiteSettingsForm extends FormBase {
'value' => Crypt::randomBytesBase64(55),
'required' => TRUE,
];
- // Remember the profile which was used.
- $settings['settings']['install_profile'] = (object) [
- 'value' => $install_state['parameters']['profile'],
- 'required' => TRUE,
- ];
drupal_rewrite_settings($settings);
diff --git a/core/lib/Drupal/Core/Site/Settings.php b/core/lib/Drupal/Core/Site/Settings.php
index bdd2609..c6fbed6 100644
--- a/core/lib/Drupal/Core/Site/Settings.php
+++ b/core/lib/Drupal/Core/Site/Settings.php
@@ -84,6 +84,9 @@ final class Settings {
* The value of the setting, the provided default if not set.
*/
public static function get($name, $default = NULL) {
+ if ($name === 'install_profile' && isset(self::$instance->storage[$name])) {
+ @trigger_error('To access the install profile in Drupal 8 use \Drupal::installProfile() or inject the install_profile container parameter into your service. See https://www.drupal.org/node/2538996', E_USER_DEPRECATED);
+ }
return isset(self::$instance->storage[$name]) ? self::$instance->storage[$name] : $default;
}
diff --git a/core/modules/system/system.install b/core/modules/system/system.install
index 0fe129b..6eb8c12 100644
--- a/core/modules/system/system.install
+++ b/core/modules/system/system.install
@@ -1015,6 +1015,21 @@ function system_requirements($phase) {
];
}
}
+
+ if ($phase === 'runtime') {
+ $settings = Settings::getAll();
+ if (array_key_exists('install_profile', $settings)) {
+ // The following message is only informational because not all site owners
+ // have access to edit their settings.php as it may be controlled by their
+ // hosting provider.
+ $requirements['install_profile_in_settings'] = [
+ 'title' => t('Install profile in settings'),
+ 'value' => t("Drupal 8 no longer uses the \$settings['install_profile'] value in settings.php and it can be removed."),
+ 'severity' => REQUIREMENT_INFO,
+ ];
+ }
+ }
+
return $requirements;
}
diff --git a/core/modules/system/tests/src/Functional/Update/InstallProfileSystemInstall8300Test.php b/core/modules/system/tests/src/Functional/Update/InstallProfileSystemInstall8300Test.php
index 623f880..0a1d03f 100644
--- a/core/modules/system/tests/src/Functional/Update/InstallProfileSystemInstall8300Test.php
+++ b/core/modules/system/tests/src/Functional/Update/InstallProfileSystemInstall8300Test.php
@@ -9,6 +9,7 @@ use Drupal\FunctionalTests\Update\UpdatePathTestBase;
* Tests system_update_8300().
*
* @group Update
+ * @group legacy
*/
class InstallProfileSystemInstall8300Test extends UpdatePathTestBase {
@@ -23,6 +24,8 @@ class InstallProfileSystemInstall8300Test extends UpdatePathTestBase {
/**
* Ensures that the system_update_8300() runs as expected.
+ *
+ * @expectedDeprecation To access the install profile in Drupal 8 use \Drupal::installProfile() or inject the install_profile container parameter into your service. See https://www.drupal.org/node/2538996
*/
public function testUpdate() {
// Ensure the BC layers work and settings.php and configuration is in the
diff --git a/core/modules/system/tests/src/Kernel/Extension/ModuleHandlerTest.php b/core/modules/system/tests/src/Kernel/Extension/ModuleHandlerTest.php
index f18c7c3..708d517 100644
--- a/core/modules/system/tests/src/Kernel/Extension/ModuleHandlerTest.php
+++ b/core/modules/system/tests/src/Kernel/Extension/ModuleHandlerTest.php
@@ -179,7 +179,7 @@ class ModuleHandlerTest extends KernelTestBase {
public function testUninstallProfileDependencyBC() {
$profile = 'testing_install_profile_dependencies_bc';
$dependency = 'dblog';
- $this->setSetting('install_profile', $profile);
+ $this->setInstallProfile($profile);
// Prime the drupal_get_filename() static cache with the location of the
// testing profile as it is not the currently active profile and we don't
// yet have any cached way to retrieve its location.
@@ -213,7 +213,7 @@ class ModuleHandlerTest extends KernelTestBase {
$profile = 'testing_install_profile_dependencies';
$dependency = 'dblog';
$non_dependency = 'ban';
- $this->setSetting('install_profile', $profile);
+ $this->setInstallProfile($profile);
// Prime the drupal_get_filename() static cache with the location of the
// testing_install_profile_dependencies profile as it is not the currently
// active profile and we don't yet have any cached way to retrieve its
@@ -252,7 +252,7 @@ class ModuleHandlerTest extends KernelTestBase {
$profile = 'testing_install_profile_all_dependencies';
$dependencies = ['dblog', 'ban'];
- $this->setSetting('install_profile', $profile);
+ $this->setInstallProfile($profile);
// Prime the drupal_get_filename() static cache with the location of the
// testing_install_profile_dependencies profile as it is not the currently
// active profile and we don't yet have any cached way to retrieve its
diff --git a/core/profiles/demo_umami/modules/demo_umami_content/tests/src/Functional/DefaultContentFilesAccessTest.php b/core/profiles/demo_umami/modules/demo_umami_content/tests/src/Functional/DefaultContentFilesAccessTest.php
index b121491..3e93494 100644
--- a/core/profiles/demo_umami/modules/demo_umami_content/tests/src/Functional/DefaultContentFilesAccessTest.php
+++ b/core/profiles/demo_umami/modules/demo_umami_content/tests/src/Functional/DefaultContentFilesAccessTest.php
@@ -2,7 +2,6 @@
namespace Drupal\Tests\demo_umami_content\Functional;
-use Drupal\Core\Site\Settings;
use Drupal\Tests\BrowserTestBase;
/**
@@ -18,7 +17,7 @@ class DefaultContentFilesAccessTest extends BrowserTestBase {
public function testAccessDeniedToFiles() {
// The demo_umami profile should not be used because we want to ensure that
// if you install another profile these files are not available.
- $this->assertNotSame('demo_umami', Settings::get('install_profile'));
+ $this->assertNotSame('demo_umami', \Drupal::installProfile());
$files_to_test = [
'images/chocolate-brownie-umami.jpg',
diff --git a/core/tests/Drupal/FunctionalTests/Installer/DistributionProfileExistingSettingsTest.php b/core/tests/Drupal/FunctionalTests/Installer/DistributionProfileExistingSettingsTest.php
index f5bcf43..acaf2c2 100644
--- a/core/tests/Drupal/FunctionalTests/Installer/DistributionProfileExistingSettingsTest.php
+++ b/core/tests/Drupal/FunctionalTests/Installer/DistributionProfileExistingSettingsTest.php
@@ -119,7 +119,7 @@ class DistributionProfileExistingSettingsTest extends InstallerTestBase {
// Confirm that Drupal recognizes this distribution as the current profile.
$this->assertEqual(\Drupal::installProfile(), 'mydistro');
- $this->assertNull(Settings::get('install_profile'), 'The install profile has not been written to settings.php.');
+ $this->assertArrayNotHasKey('install_profile', Settings::getAll(), 'The install profile has not been written to settings.php.');
$this->assertEqual($this->config('core.extension')->get('profile'), 'mydistro', 'The install profile has been written to core.extension configuration.');
$this->rebuildContainer();
diff --git a/core/tests/Drupal/FunctionalTests/Installer/DistributionProfileTest.php b/core/tests/Drupal/FunctionalTests/Installer/DistributionProfileTest.php
index 1e43929..630ec15 100644
--- a/core/tests/Drupal/FunctionalTests/Installer/DistributionProfileTest.php
+++ b/core/tests/Drupal/FunctionalTests/Installer/DistributionProfileTest.php
@@ -3,7 +3,6 @@
namespace Drupal\FunctionalTests\Installer;
use Drupal\Core\Serialization\Yaml;
-use Drupal\Core\Site\Settings;
/**
* Tests distribution profile support.
@@ -74,7 +73,6 @@ class DistributionProfileTest extends InstallerTestBase {
// Confirm that Drupal recognizes this distribution as the current profile.
$this->assertEqual(\Drupal::installProfile(), 'mydistro');
- $this->assertEqual(Settings::get('install_profile'), 'mydistro', 'The install profile has been written to settings.php.');
$this->assertEqual($this->config('core.extension')->get('profile'), 'mydistro', 'The install profile has been written to core.extension configuration.');
}
diff --git a/core/tests/Drupal/FunctionalTests/Installer/InstallerExistingSettingsMismatchProfileTest.php b/core/tests/Drupal/FunctionalTests/Installer/InstallerExistingSettingsMismatchProfileTest.php
index 7d82300..18dd66d 100644
--- a/core/tests/Drupal/FunctionalTests/Installer/InstallerExistingSettingsMismatchProfileTest.php
+++ b/core/tests/Drupal/FunctionalTests/Installer/InstallerExistingSettingsMismatchProfileTest.php
@@ -8,9 +8,10 @@ use Drupal\Core\Database\Database;
use Symfony\Component\HttpFoundation\Request;
/**
- * Tests the installer with an existing settings file but no install profile.
+ * Tests install with existing settings.php and a mismatching install profile.
*
* @group Installer
+ * @group legacy
*/
class InstallerExistingSettingsMismatchProfileTest extends InstallerTestBase {
@@ -88,6 +89,8 @@ class InstallerExistingSettingsMismatchProfileTest extends InstallerTestBase {
/**
* Verifies that installation succeeded.
+ *
+ * @expectedDeprecation To access the install profile in Drupal 8 use \Drupal::installProfile() or inject the install_profile container parameter into your service. See https://www.drupal.org/node/2538996
*/
public function testInstaller() {
$this->assertUrl('user/1');
diff --git a/core/tests/Drupal/FunctionalTests/Installer/InstallerExistingSettingsMismatchProfileBrokenTest.php b/core/tests/Drupal/FunctionalTests/Installer/InstallerExistingSettingsReadOnlyMismatchProfileTest.php
index 21f628c..2b0b35e 100644
--- a/core/tests/Drupal/FunctionalTests/Installer/InstallerExistingSettingsMismatchProfileBrokenTest.php
+++ b/core/tests/Drupal/FunctionalTests/Installer/InstallerExistingSettingsReadOnlyMismatchProfileTest.php
@@ -4,14 +4,16 @@ namespace Drupal\FunctionalTests\Installer;
use Drupal\Core\DrupalKernel;
use Drupal\Core\Database\Database;
+use Drupal\Core\Site\Settings;
use Symfony\Component\HttpFoundation\Request;
/**
* Tests installer breaks with a profile mismatch and a read-only settings.php.
*
* @group Installer
+ * @group legacy
*/
-class InstallerExistingSettingsMismatchProfileBrokenTest extends InstallerTestBase {
+class InstallerExistingSettingsReadOnlyMismatchProfileTest extends InstallerTestBase {
/**
* {@inheritdoc}
@@ -91,16 +93,18 @@ class InstallerExistingSettingsMismatchProfileBrokenTest extends InstallerTestBa
// already.
}
- protected function setUpSite() {
- // This step should not appear, since settings.php could not be written.
- }
-
/**
- * Verifies that installation did not succeed.
+ * Verifies that installation succeeded.
+ *
+ * @expectedDeprecation To access the install profile in Drupal 8 use \Drupal::installProfile() or inject the install_profile container parameter into your service. See https://www.drupal.org/node/2538996
*/
- public function testBrokenInstaller() {
- $this->assertTitle('Install profile mismatch | Drupal');
- $this->assertText("The selected profile testing does not match the install_profile setting, which is minimal. Cannot write updated setting to {$this->siteDirectory}/settings.php.");
+ public function testInstalled() {
+ $this->initBrowserOutputFile();
+ $this->htmlOutput(NULL);
+ $this->assertEquals('testing', \Drupal::installProfile());
+ $this->assertEquals('minimal', Settings::get('install_profile'));
+ $this->drupalGet('admin/reports/status');
+ $this->assertSession()->pageTextContains("Drupal 8 no longer uses the \$settings['install_profile'] value in settings.php and it can be removed.");
}
}
diff --git a/core/tests/Drupal/FunctionalTests/Installer/InstallerExistingSettingsTest.php b/core/tests/Drupal/FunctionalTests/Installer/InstallerExistingSettingsTest.php
index a6059e1..3b85dca 100644
--- a/core/tests/Drupal/FunctionalTests/Installer/InstallerExistingSettingsTest.php
+++ b/core/tests/Drupal/FunctionalTests/Installer/InstallerExistingSettingsTest.php
@@ -2,7 +2,6 @@
namespace Drupal\FunctionalTests\Installer;
-use Drupal\Core\Site\Settings;
use Drupal\Core\Database\Database;
use Drupal\Core\DrupalKernel;
use Symfony\Component\HttpFoundation\Request;
@@ -29,13 +28,6 @@ class InstallerExistingSettingsTest extends InstallerTestBase {
'required' => TRUE,
];
- // During interactive install we'll change this to a different profile and
- // this test will ensure that the new value is written to settings.php.
- $this->settings['settings']['install_profile'] = (object) [
- 'value' => 'minimal',
- 'required' => TRUE,
- ];
-
// Pre-configure database credentials.
$connection_info = Database::getConnectionInfo();
unset($connection_info['default']['pdo']);
@@ -73,8 +65,7 @@ class InstallerExistingSettingsTest extends InstallerTestBase {
public function testInstaller() {
$this->assertUrl('user/1');
$this->assertResponse(200);
- $this->assertEqual('testing', \Drupal::installProfile(), 'Profile was changed from minimal to testing during interactive install.');
- $this->assertEqual('testing', Settings::get('install_profile'), 'Profile was correctly changed to testing in Settings.php');
+ $this->assertEqual('testing', \Drupal::installProfile());
}
}
diff --git a/core/tests/Drupal/FunctionalTests/Installer/MultipleDistributionsProfileTest.php b/core/tests/Drupal/FunctionalTests/Installer/MultipleDistributionsProfileTest.php
index 1c01e72..fe3b3d9 100644
--- a/core/tests/Drupal/FunctionalTests/Installer/MultipleDistributionsProfileTest.php
+++ b/core/tests/Drupal/FunctionalTests/Installer/MultipleDistributionsProfileTest.php
@@ -3,7 +3,6 @@
namespace Drupal\FunctionalTests\Installer;
use Drupal\Component\Serialization\Yaml;
-use Drupal\Core\Site\Settings;
/**
* Tests multiple distribution profile support.
@@ -78,7 +77,6 @@ class MultipleDistributionsProfileTest extends InstallerTestBase {
// Confirm that Drupal recognizes this distribution as the current profile.
$this->assertEqual(\Drupal::installProfile(), 'distribution_one');
- $this->assertEqual(Settings::get('install_profile'), 'distribution_one', 'The install profile has been written to settings.php.');
$this->assertEqual($this->config('core.extension')->get('profile'), 'distribution_one', 'The install profile has been written to core.extension configuration.');
$this->rebuildContainer();
diff --git a/core/tests/Drupal/KernelTests/Core/Extension/ModuleExtensionListTest.php b/core/tests/Drupal/KernelTests/Core/Extension/ModuleExtensionListTest.php
index 3ffef4a..dd5d13e 100644
--- a/core/tests/Drupal/KernelTests/Core/Extension/ModuleExtensionListTest.php
+++ b/core/tests/Drupal/KernelTests/Core/Extension/ModuleExtensionListTest.php
@@ -2,7 +2,6 @@
namespace Drupal\KernelTests\Core\Extension;
-use Drupal\Core\Site\Settings;
use Drupal\KernelTests\KernelTestBase;
/**
@@ -15,12 +14,9 @@ class ModuleExtensionListTest extends KernelTestBase {
* @covers ::getList
*/
public function testGetlist() {
- $settings = Settings::getAll();
- $settings['install_profile'] = 'testing';
- new Settings($settings);
-
\Drupal::configFactory()->getEditable('core.extension')
->set('module.testing', 1000)
+ ->set('profile', 'testing')
->save();
// The installation profile is provided by a container parameter.
diff --git a/core/tests/Drupal/KernelTests/KernelTestBase.php b/core/tests/Drupal/KernelTests/KernelTestBase.php
index 71cb93f..021e38d 100644
--- a/core/tests/Drupal/KernelTests/KernelTestBase.php
+++ b/core/tests/Drupal/KernelTests/KernelTestBase.php
@@ -934,12 +934,33 @@ abstract class KernelTestBase extends TestCase implements ServiceProviderInterfa
* \Drupal\Core\Site\Settings::get() to perform custom merges.
*/
protected function setSetting($name, $value) {
+ if ($name === 'install_profile') {
+ @trigger_error('Use \Drupal\KernelTests\KernelTestBase::setInstallProfile() to set the install profile in kernel tests. See https://www.drupal.org/node/2538996', E_USER_DEPRECATED);
+ $this->setInstallProfile($value);
+ }
$settings = Settings::getInstance() ? Settings::getAll() : [];
$settings[$name] = $value;
new Settings($settings);
}
/**
+ * Sets the install profile and rebuilds the container to update it.
+ *
+ * @param string $profile
+ * The install profile to set.
+ */
+ protected function setInstallProfile($profile) {
+ $this->container->get('config.factory')
+ ->getEditable('core.extension')
+ ->set('profile', $profile)
+ ->save();
+
+ // The installation profile is provided by a container parameter. Saving
+ // the configuration doesn't automatically trigger invalidation
+ $this->container->get('kernel')->rebuildContainer();
+ }
+
+ /**
* Stops test execution.
*/
protected function stop() {
diff --git a/sites/default/default.settings.php b/sites/default/default.settings.php
index 1e002a1..5bcecc2 100644
--- a/sites/default/default.settings.php
+++ b/sites/default/default.settings.php
@@ -264,23 +264,6 @@ $config_directories = [];
*/
/**
- * The active installation profile.
- *
- * Changing this after installation is not recommended as it changes which
- * directories are scanned during extension discovery. If this is set prior to
- * installation this value will be rewritten according to the profile selected
- * by the user.
- *
- * @see install_select_profile()
- *
- * @deprecated in Drupal 8.3.0 and will be removed before Drupal 9.0.0. The
- * install profile is written to the core.extension configuration. If a
- * service requires the install profile use the 'install_profile' container
- * parameter. Functional code can use \Drupal::installProfile().
- */
-# $settings['install_profile'] = '';
-
-/**
* Salt for one-time login links, cancel links, form tokens, etc.
*
* This variable will be set to a random value by the installer. All one-time