diff --git a/core/lib/Drupal/Core/Config/ConfigInstaller.php b/core/lib/Drupal/Core/Config/ConfigInstaller.php index fce8628..7153ab9 100644 --- a/core/lib/Drupal/Core/Config/ConfigInstaller.php +++ b/core/lib/Drupal/Core/Config/ConfigInstaller.php @@ -11,7 +11,6 @@ use Drupal\Core\Config\Entity\ConfigDependencyManager; use Drupal\Core\Config\Entity\ConfigEntityDependency; use Drupal\Core\Entity\EntityTypeInterface; -use Drupal\Core\Site\Settings; use Symfony\Component\EventDispatcher\EventDispatcherInterface; class ConfigInstaller implements ConfigInstallerInterface { diff --git a/core/lib/Drupal/Core/DrupalKernel.php b/core/lib/Drupal/Core/DrupalKernel.php index ce5e7d8..65a3a20 100644 --- a/core/lib/Drupal/Core/DrupalKernel.php +++ b/core/lib/Drupal/Core/DrupalKernel.php @@ -1452,9 +1452,12 @@ protected function addServiceFiles($service_yamls) { } /** - * {@inheritdoc} + * Gets the active install profile. + * + * @return string|null + * The name of the any active install profile or distribution. */ - public function getInstallProfile() { + protected function getInstallProfile() { $install_profile = Settings::get('install_profile'); if (empty($install_profile)) { $install_profile = $this->getDistribution(); diff --git a/core/lib/Drupal/Core/DrupalKernelInterface.php b/core/lib/Drupal/Core/DrupalKernelInterface.php index 33ac646..287102b 100644 --- a/core/lib/Drupal/Core/DrupalKernelInterface.php +++ b/core/lib/Drupal/Core/DrupalKernelInterface.php @@ -135,14 +135,6 @@ public function preHandle(Request $request); public function loadLegacyIncludes(); /** - * Gets the active install profile. - * - * @return string|null - * The name of the any active install profile or distribution. - */ - public function getInstallProfile(); - - /** * Get the name of any discovered profile that is a distribution. * * If multiple profiles are distributions, then the first discovered profile diff --git a/core/modules/system/src/Tests/Bootstrap/GetFilenameUnitTest.php b/core/modules/system/src/Tests/Bootstrap/GetFilenameUnitTest.php index 27ca162..2d28302 100644 --- a/core/modules/system/src/Tests/Bootstrap/GetFilenameUnitTest.php +++ b/core/modules/system/src/Tests/Bootstrap/GetFilenameUnitTest.php @@ -8,6 +8,7 @@ namespace Drupal\system\Tests\Bootstrap; use Drupal\simpletest\KernelTestBase; +use Drupal\Core\DependencyInjection\ContainerBuilder; /** * Tests that drupal_get_filename() works correctly. @@ -17,14 +18,18 @@ class GetFilenameUnitTest extends KernelTestBase { /** + * {@inheritdoc} + */ + public function containerBuild(ContainerBuilder $container) { + parent::containerBuild($container); + // Use the testing install profile. + $container->setParameter('install_profile', 'testing'); + } + + /** * 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'; - // Rebuild system.module.files state data. // @todo Remove as part of https://www.drupal.org/node/2186491 drupal_static_reset('system_rebuild_module_data'); diff --git a/core/modules/system/src/Tests/Installer/InstallerExistingSettingsNoProfileTest.php b/core/modules/system/src/Tests/Installer/InstallerExistingSettingsNoProfileTest.php index c664028..f7b41fe 100644 --- a/core/modules/system/src/Tests/Installer/InstallerExistingSettingsNoProfileTest.php +++ b/core/modules/system/src/Tests/Installer/InstallerExistingSettingsNoProfileTest.php @@ -7,7 +7,6 @@ namespace Drupal\system\Tests\Installer; -use Drupal\Core\Site\Settings; use Drupal\simpletest\InstallerTestBase; use Drupal\Core\Database\Database; diff --git a/sites/default/default.settings.php b/sites/default/default.settings.php index 9ad5cae..99ec3a9 100644 --- a/sites/default/default.settings.php +++ b/sites/default/default.settings.php @@ -258,12 +258,20 @@ /** * The active installation profile. * + * This setting should not be accessed directly using the Settings object. Use + * \Drupal::installProfile() or inject the install_profile container parameter + * instead. + * * 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. + * by the user. If the installation is using a distribution then this does not + * need to be set. * * @see install_select_profile() + * @see \Drupal::installProfile() + * @see \Drupal\Core\DrupalKernel::getInstallProfile() + * @see \Drupal\Core\DrupalKernel::getDistribution() */ # $settings['install_profile'] = '';