diff --git a/core/lib/Drupal/Core/DrupalKernel.php b/core/lib/Drupal/Core/DrupalKernel.php index bc85ccd04c3..ab00d3f9f78 100644 --- a/core/lib/Drupal/Core/DrupalKernel.php +++ b/core/lib/Drupal/Core/DrupalKernel.php @@ -491,7 +491,7 @@ class DrupalKernel implements DrupalKernelInterface, TerminableInterface { // Continue if the PharStreamWrapperManager is already initialized. For // example, this occurs during a module install. // @see \Drupal\Core\Extension\ModuleInstaller::install() - }; + } stream_wrapper_unregister('phar'); stream_wrapper_register('phar', PharStreamWrapper::class); } @@ -1602,18 +1602,9 @@ class DrupalKernel implements DrupalKernelInterface, TerminableInterface { */ protected function getInstallProfile() { $config = $this->getConfigStorage()->read('core.extension'); - 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. - $settings = Settings::getAll(); - $install_profile = isset($settings['install_profile']) ? $settings['install_profile'] : NULL; - } // Normalize an empty string to a NULL value. - return empty($install_profile) ? NULL : $install_profile; + return $config['profile'] ?? NULL; } } diff --git a/core/lib/Drupal/Core/Site/Settings.php b/core/lib/Drupal/Core/Site/Settings.php index e6b3cfa33c6..762462464b3 100644 --- a/core/lib/Drupal/Core/Site/Settings.php +++ b/core/lib/Drupal/Core/Site/Settings.php @@ -84,9 +84,6 @@ 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 e6ee8bdd0ac..61ec3aed1b3 100644 --- a/core/modules/system/system.install +++ b/core/modules/system/system.install @@ -1021,8 +1021,8 @@ function system_requirements($phase) { // 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, + 'value' => t("Drupal 9 no longer uses the \$settings['install_profile'] value in settings.php and it should be removed."), + 'severity' => REQUIREMENT_WARNING, ]; } } diff --git a/core/tests/Drupal/FunctionalTests/Installer/DistributionProfileExistingSettingsTest.php b/core/tests/Drupal/FunctionalTests/Installer/DistributionProfileExistingSettingsTest.php index d5194bdec11..4b3c13af587 100644 --- a/core/tests/Drupal/FunctionalTests/Installer/DistributionProfileExistingSettingsTest.php +++ b/core/tests/Drupal/FunctionalTests/Installer/DistributionProfileExistingSettingsTest.php @@ -5,7 +5,6 @@ namespace Drupal\FunctionalTests\Installer; use Drupal\Component\Serialization\Yaml; use Drupal\Core\Database\Database; use Drupal\Core\DrupalKernel; -use Drupal\Core\Site\Settings; use Symfony\Component\HttpFoundation\Request; /** @@ -122,7 +121,6 @@ class DistributionProfileExistingSettingsTest extends InstallerTestBase { // Confirm that Drupal recognizes this distribution as the current profile. $this->assertEqual(\Drupal::installProfile(), 'mydistro'); - $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/InstallerExistingSettingsReadOnlyMismatchProfileTest.php b/core/tests/Drupal/FunctionalTests/Installer/InstallerExistingSettingsReadOnlyMismatchProfileTest.php deleted file mode 100644 index 86ac0a5956f..00000000000 --- a/core/tests/Drupal/FunctionalTests/Installer/InstallerExistingSettingsReadOnlyMismatchProfileTest.php +++ /dev/null @@ -1,113 +0,0 @@ -settings['settings']['hash_salt'] = (object) [ - 'value' => __CLASS__, - 'required' => TRUE, - ]; - - // Pre-configure database credentials. - $connection_info = Database::getConnectionInfo(); - unset($connection_info['default']['pdo']); - unset($connection_info['default']['init_commands']); - - $this->settings['databases']['default'] = (object) [ - 'value' => $connection_info, - '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 config directories. - $site_path = DrupalKernel::findSitePath(Request::createFromGlobals()); - $this->settings['settings']['config_sync_directory'] = (object) [ - 'value' => $site_path . '/files/config_staging', - 'required' => TRUE, - ]; - mkdir($this->settings['settings']['config_sync_directory']->value, 0777, TRUE); - } - - /** - * {@inheritdoc} - */ - protected function visitInstaller() { - // Make settings file not writable. This will break the installer. - $filename = $this->siteDirectory . '/settings.php'; - // Make the settings file read-only. - // Not using File API; a potential error must trigger a PHP warning. - chmod($filename, 0444); - - $this->drupalGet($GLOBALS['base_url'] . '/core/install.php?langcode=en&profile=testing'); - } - - /** - * {@inheritdoc} - */ - protected function setUpLanguage() { - // This step is skipped, because there is a lagcode as a query param. - } - - /** - * {@inheritdoc} - */ - protected function setUpProfile() { - // This step is skipped, because there is a profile as a query param. - } - - /** - * {@inheritdoc} - */ - protected function setUpSettings() { - // This step should not appear, since settings.php is fully configured - // already. - } - - /** - * 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 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/Update/UpdatePathTestBase.php b/core/tests/Drupal/FunctionalTests/Update/UpdatePathTestBase.php index 98ba5be9c53..6fa592066bd 100644 --- a/core/tests/Drupal/FunctionalTests/Update/UpdatePathTestBase.php +++ b/core/tests/Drupal/FunctionalTests/Update/UpdatePathTestBase.php @@ -66,13 +66,6 @@ abstract class UpdatePathTestBase extends BrowserTestBase { */ protected $databaseDumpFiles = []; - /** - * The install profile used in the database dump file. - * - * @var string - */ - protected $installProfile = 'standard'; - /** * Flag that indicates whether the child site has been updated. * @@ -250,11 +243,6 @@ abstract class UpdatePathTestBase extends BrowserTestBase { protected function prepareSettings() { parent::prepareSettings(); - // Remember the profile which was used. - $settings['settings']['install_profile'] = (object) [ - 'value' => $this->installProfile, - 'required' => TRUE, - ]; // Generate a hash salt. $settings['settings']['hash_salt'] = (object) [ 'value' => Crypt::randomBytesBase64(55), diff --git a/core/tests/Drupal/KernelTests/Core/Extension/ThemeEngineExtensionListTest.php b/core/tests/Drupal/KernelTests/Core/Extension/ThemeEngineExtensionListTest.php index 3f59ff0e976..1a3ce0365ca 100644 --- a/core/tests/Drupal/KernelTests/Core/Extension/ThemeEngineExtensionListTest.php +++ b/core/tests/Drupal/KernelTests/Core/Extension/ThemeEngineExtensionListTest.php @@ -2,7 +2,6 @@ namespace Drupal\KernelTests\Core\Extension; -use Drupal\Core\Site\Settings; use Drupal\KernelTests\KernelTestBase; /** @@ -15,10 +14,6 @@ class ThemeEngineExtensionListTest extends KernelTestBase { * @covers ::getList */ public function testGetlist() { - $settings = Settings::getAll(); - $settings['install_profile'] = 'testing'; - new Settings($settings); - // Confirm that all theme engines are available. $theme_engines = \Drupal::service('extension.list.theme_engine')->getList(); $this->assertArrayHasKey('twig', $theme_engines); diff --git a/core/tests/Drupal/KernelTests/Core/Extension/ThemeExtensionListTest.php b/core/tests/Drupal/KernelTests/Core/Extension/ThemeExtensionListTest.php index 09829839229..9b80e5a1efc 100644 --- a/core/tests/Drupal/KernelTests/Core/Extension/ThemeExtensionListTest.php +++ b/core/tests/Drupal/KernelTests/Core/Extension/ThemeExtensionListTest.php @@ -2,7 +2,6 @@ namespace Drupal\KernelTests\Core\Extension; -use Drupal\Core\Site\Settings; use Drupal\KernelTests\KernelTestBase; /** @@ -15,10 +14,6 @@ class ThemeExtensionListTest 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('theme.test_theme', 0)