Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/matomo-org/matomo.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordiosmosis <benakamoorthi@fastmail.fm>2014-03-22 11:01:19 +0400
committerdiosmosis <benakamoorthi@fastmail.fm>2014-03-22 11:33:50 +0400
commit3c119c8416b27a83d543e8b3cf0f5ffea932712f (patch)
tree48aecfb6383722be3d2c6ad5067521597c80ef72 /core/Config.php
parent4a03941a576937aba15b0f2f9786bcd8d86248d5 (diff)
Do not use static variables for config paths since they can now be specified upon construction.
Diffstat (limited to 'core/Config.php')
-rw-r--r--core/Config.php49
1 files changed, 40 insertions, 9 deletions
diff --git a/core/Config.php b/core/Config.php
index 4d0c4d9a65..eae234041e 100644
--- a/core/Config.php
+++ b/core/Config.php
@@ -40,9 +40,9 @@ use Exception;
*/
class Config extends Singleton
{
- public static $defaultLocalConfigPath = '/config/config.ini.php';
- public static $defaultCommonConfigPath = '/config/common.config.ini.php';
- public static $defaultGlobalConfigPath = '/config/global.ini.php';
+ const DEFAULT_LOCAL_CONFIG_PATH = '/config/config.ini.php';
+ const DEFAULT_COMMON_CONFIG_PATH = '/config/common.config.ini.php';
+ const DEFAULT_GLOBAL_CONFIG_PATH = '/config/global.ini.php';
/**
* Contains configuration files values
@@ -59,6 +59,11 @@ class Config extends Singleton
protected $pathLocal = null;
/**
+ * @var boolean
+ */
+ protected $isTest = false;
+
+ /**
* Constructor
*/
public function __construct($pathGlobal = null, $pathLocal = null, $pathCommon = null)
@@ -69,9 +74,34 @@ class Config extends Singleton
}
/**
- * @var boolean
+ * Returns the path to the local config file used by this instance.
+ *
+ * @return string
*/
- protected $isTest = false;
+ public function getLocalPath()
+ {
+ return $this->pathLocal;
+ }
+
+ /**
+ * Returns the path to the global config file used by this instance.
+ *
+ * @return string
+ */
+ public function getGlobalPath()
+ {
+ return $this->pathGlobal;
+ }
+
+ /**
+ * Returns the path to the common config file used by this instance.
+ *
+ * @return string
+ */
+ public function getCommonPath()
+ {
+ return $this->pathCommon;
+ }
/**
* Enable test environment
@@ -137,7 +167,7 @@ class Config extends Singleton
*/
protected static function getGlobalConfigPath()
{
- return PIWIK_USER_PATH . self::$defaultGlobalConfigPath;
+ return PIWIK_USER_PATH . self::DEFAULT_GLOBAL_CONFIG_PATH;
}
/**
@@ -147,7 +177,7 @@ class Config extends Singleton
*/
public static function getCommonConfigPath()
{
- return PIWIK_USER_PATH . self::$defaultCommonConfigPath;
+ return PIWIK_USER_PATH . self::DEFAULT_COMMON_CONFIG_PATH;
}
/**
@@ -161,7 +191,7 @@ class Config extends Singleton
if ($path) {
return $path;
}
- return PIWIK_USER_PATH . self::$defaultLocalConfigPath;
+ return PIWIK_USER_PATH . self::DEFAULT_LOCAL_CONFIG_PATH;
}
private static function getLocalConfigInfoForHostname($hostname)
@@ -351,7 +381,8 @@ class Config extends Singleton
// must be called here, not in init(), since setTestEnvironment() calls init(). (this avoids
// infinite recursion)
- Piwik::postTestEvent('Config.createConfigSingleton', array( $this, &$this->configCache ));
+ Piwik::postTestEvent('Config.createConfigSingleton',
+ array($this, &$this->configCache, &$this->configLocal));
}
// check cache for merged section