diff --git a/core/includes/install.core.inc b/core/includes/install.core.inc index c621ea2..39cba38 100644 --- a/core/includes/install.core.inc +++ b/core/includes/install.core.inc @@ -399,7 +399,7 @@ function install_begin_request($class_loader, &$install_state) { $container = $kernel->getContainer(); // Register the file translation service. - $config_overrides = Settings::getConfigOverrides(); + $config_overrides = Settings::getAllConfigOverrides(); if (isset($config_overrides['locale.settings']['translation']['path'])) { $directory = $config_overrides['locale.settings']['translation']['path']; } diff --git a/core/includes/install.inc b/core/includes/install.inc index cdd967b..7720968 100644 --- a/core/includes/install.inc +++ b/core/includes/install.inc @@ -328,7 +328,7 @@ function drupal_rewrite_settings($settings = array(), $settings_file = NULL) { // Settings singleton. if (!empty($settings_settings) || !empty($config_overrides)) { $old_settings = Settings::getAll(); - new Settings($settings_settings + $old_settings, Settings::getConfigOverrides() + $config_overrides); + new Settings($settings_settings + $old_settings, Settings::getAllConfigOverrides() + $config_overrides); } // The existing settings.php file might have been included already. In // case an opcode cache is enabled, the rewritten contents of the file diff --git a/core/lib/Drupal/Core/Config/ConfigFactory.php b/core/lib/Drupal/Core/Config/ConfigFactory.php index bce29dc..ec3f06f 100644 --- a/core/lib/Drupal/Core/Config/ConfigFactory.php +++ b/core/lib/Drupal/Core/Config/ConfigFactory.php @@ -133,8 +133,8 @@ protected function doGet($name, $immutable = TRUE) { $this->cache[$cache_key]->setModuleOverride($overrides[$name]); } // Apply any settings.php overrides. - if ($this->settings->hasConfigOverride($name)) { - $this->cache[$cache_key]->setSettingsOverride($this->settings->getConfigOverride($name)); + if ($override = $this->settings->getConfigOverride($name)) { + $this->cache[$cache_key]->setSettingsOverride($override); } } return $this->cache[$cache_key]; @@ -190,8 +190,8 @@ protected function doLoadMultiple(array $names, $immutable = TRUE) { if (isset($module_overrides[$name])) { $this->cache[$cache_key]->setModuleOverride($module_overrides[$name]); } - if ($this->settings->hasConfigOverride($name)) { - $this->cache[$cache_key]->setSettingsOverride($this->settings->getConfigOverride($name)); + if ($override = $this->settings->getConfigOverride($name)) { + $this->cache[$cache_key]->setSettingsOverride($override); } } $list[$name] = $this->cache[$cache_key]; diff --git a/core/lib/Drupal/Core/Site/Settings.php b/core/lib/Drupal/Core/Site/Settings.php index 82ab5ce..44388af 100644 --- a/core/lib/Drupal/Core/Site/Settings.php +++ b/core/lib/Drupal/Core/Site/Settings.php @@ -94,20 +94,16 @@ public static function get($name, $default = NULL) { } /** - * Returns a config override. + * Returns overrides for a specified configuration object. * - * @param string $name - * The name of the setting to return. + * @param string $config_name + * The name of the configuration object. * * @return mixed - * The value of the config override, NULL if not set. + * The value of the configuration override, NULL if not set. */ - public static function getConfigOverride($name) { - return self::hasConfigOverride($name) ? self::$instance->configOverrides[$name] : NULL; - } - - public static function hasConfigOverride($name) { - return array_key_exists($name, self::$instance->configOverrides); + public static function getConfigOverride($config_name) { + return isset(self::$instance->configOverrides[$config_name]) ? self::$instance->configOverrides[$config_name] : NULL; } /** @@ -124,9 +120,9 @@ public static function getAll() { * Returns all the config overrides. This is only used for testing purposes. * * @return array - * All the config overrides. + * All the configuration overrides. */ - public static function getConfigOverrides() { + public static function getAllConfigOverrides() { return self::$instance->configOverrides; } diff --git a/core/modules/config/src/Tests/ConfigEventsTest.php b/core/modules/config/src/Tests/ConfigEventsTest.php index 472296a..d8caad5 100644 --- a/core/modules/config/src/Tests/ConfigEventsTest.php +++ b/core/modules/config/src/Tests/ConfigEventsTest.php @@ -65,7 +65,7 @@ function testConfigEvents() { function testConfigRenameEvent() { $name = 'config_events_test.test'; $new_name = 'config_events_test.test_rename'; - $overrides = Settings::getConfigOverrides(); + $overrides = Settings::getAllConfigOverrides(); $overrides[$name] = array('key' => 'overridden'); $overrides[$new_name] = array('key' => 'new overridden'); new Settings(Settings::getAll(), $overrides); diff --git a/core/modules/config/src/Tests/ConfigOverridesPriorityTest.php b/core/modules/config/src/Tests/ConfigOverridesPriorityTest.php index 7c4fb2f..aef8454 100644 --- a/core/modules/config/src/Tests/ConfigOverridesPriorityTest.php +++ b/core/modules/config/src/Tests/ConfigOverridesPriorityTest.php @@ -84,7 +84,7 @@ public function testOverridePriorities() { // Configure a global override to simulate overriding using settings.php. Do // not override system.site:mail or system.site:slogan to prove that the // language and module overrides still apply. - $overrides = Settings::getConfigOverrides(); + $overrides = Settings::getAllConfigOverrides(); $overrides['system.site']['name'] = 'Site name global conf override'; new Settings(Settings::getAll(), $overrides); $config_factory->reset('system.site'); diff --git a/core/modules/simpletest/src/KernelTestBase.php b/core/modules/simpletest/src/KernelTestBase.php index 899fa4a..9009a88 100644 --- a/core/modules/simpletest/src/KernelTestBase.php +++ b/core/modules/simpletest/src/KernelTestBase.php @@ -197,7 +197,7 @@ protected function setUp() { // Restore and merge settings. // DrupalKernel::boot() initializes new Settings, and the containerBuild() // method sets additional settings. - new Settings($settings + Settings::getAll(), Settings::getConfigOverrides()); + new Settings($settings + Settings::getAll(), Settings::getAllConfigOverrides()); // Create and set new configuration directories. $this->prepareConfigDirectories(); diff --git a/core/modules/simpletest/src/TestBase.php b/core/modules/simpletest/src/TestBase.php index 7337617..c11763e 100644 --- a/core/modules/simpletest/src/TestBase.php +++ b/core/modules/simpletest/src/TestBase.php @@ -1142,7 +1142,7 @@ private function prepareEnvironment() { // Backup current in-memory configuration. $this->originalSite = conf_path(); $this->originalSettings = Settings::getAll(); - $this->originalConfig = Settings::getConfigOverrides(); + $this->originalConfig = Settings::getAllConfigOverrides(); // @todo Remove all remnants of $GLOBALS['conf']. // @see https://drupal.org/node/2183323 $this->originalConf = isset($GLOBALS['conf']) ? $GLOBALS['conf'] : NULL; diff --git a/core/modules/system/system.install b/core/modules/system/system.install index 9265ec3..871ae51 100644 --- a/core/modules/system/system.install +++ b/core/modules/system/system.install @@ -396,7 +396,7 @@ function system_requirements($phase) { if ($file_private_path = Settings::get('file_private_path')) { $directories[] = $file_private_path; } - $overrides = Settings::getConfigOverrides(); + $overrides = Settings::getAllConfigOverrides(); if (!empty($overrides['system.file']['path']['temporary'])) { $directories[] = $overrides['system.file']['path']['temporary']; }