From 883ecb69fde108181e4188b7eedb9a8bbe564e4f Mon Sep 17 00:00:00 2001 From: Matthieu Napoli Date: Fri, 3 Apr 2015 12:14:22 +1300 Subject: #7601 Removed the dependency from the container to the config The container now uses IniFileChain, which means it doesn't need the Config object anymore. --- core/Config.php | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'core/Config.php') diff --git a/core/Config.php b/core/Config.php index ee0107c706..86eaa94d98 100644 --- a/core/Config.php +++ b/core/Config.php @@ -12,6 +12,7 @@ namespace Piwik; use Exception; use Piwik\Config\IniFileChain; use Piwik\Config\ConfigNotFoundException; +use Piwik\Config\IniFileChainFactory; use Piwik\Ini\IniReadingException; /** @@ -72,7 +73,7 @@ class Config extends Singleton $this->pathCommon = $pathCommon ?: self::getCommonConfigPath(); $this->pathLocal = $pathLocal ?: self::getLocalConfigPath(); - $this->settings = new IniFileChain(); + $this->settings = IniFileChainFactory::get(); } /** @@ -155,7 +156,7 @@ class Config extends Singleton * * @return string */ - protected static function getGlobalConfigPath() + public static function getGlobalConfigPath() { return PIWIK_USER_PATH . self::DEFAULT_GLOBAL_CONFIG_PATH; } @@ -334,16 +335,15 @@ class Config extends Singleton } try { + // Force a reload because maybe the files to use were overridden in the Config's constructor $this->settings->reload(array($this->pathGlobal, $this->pathCommon), $this->pathLocal); } catch (IniReadingException $e) { + // TODO why a different behavior here? This needs a comment if ($inTrackerRequest) { throw $e; } } - // decode section datas - $this->decodeValues($this->settings->getAll()); - // Check config.ini.php last if (!$inTrackerRequest) { $this->checkLocalConfigFound(); @@ -374,11 +374,11 @@ class Config extends Singleton * @param mixed $values * @return mixed */ - protected function decodeValues(&$values) + public static function decodeValues(&$values) { if (is_array($values)) { foreach ($values as &$value) { - $value = $this->decodeValues($value); + $value = self::decodeValues($value); } return $values; } elseif (is_string($values)) { -- cgit v1.2.3