diff options
author | Matthieu Napoli <matthieu@mnapoli.fr> | 2015-04-03 02:14:22 +0300 |
---|---|---|
committer | Matthieu Napoli <matthieu@mnapoli.fr> | 2015-04-03 02:14:22 +0300 |
commit | 883ecb69fde108181e4188b7eedb9a8bbe564e4f (patch) | |
tree | 5562f140e5a1db687766fbbe8b0f00a5eed43f30 /core/Config.php | |
parent | 695bfe6c853cdd0afb4c37ac91dc612145fb4b60 (diff) |
#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.
Diffstat (limited to 'core/Config.php')
-rw-r--r-- | core/Config.php | 14 |
1 files changed, 7 insertions, 7 deletions
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)) { |