diff options
author | diosmosis <benaka@piwik.pro> | 2015-04-03 06:57:59 +0300 |
---|---|---|
committer | diosmosis <benaka@piwik.pro> | 2015-04-03 06:57:59 +0300 |
commit | 633d1adeec3d0f2d3faaede7334bdc0d2c53897a (patch) | |
tree | 614c69dbf91a236a0ed9e54140628be40b059991 /core/Config.php | |
parent | 18c82768e268af9edccdce979779b10d450f8165 (diff) |
Hacking away so it's possible for certain pro plugin tests to pass.
Diffstat (limited to 'core/Config.php')
-rw-r--r-- | core/Config.php | 30 |
1 files changed, 17 insertions, 13 deletions
diff --git a/core/Config.php b/core/Config.php index 86eaa94d98..2245ba7a73 100644 --- a/core/Config.php +++ b/core/Config.php @@ -73,7 +73,7 @@ class Config extends Singleton $this->pathCommon = $pathCommon ?: self::getCommonConfigPath(); $this->pathLocal = $pathLocal ?: self::getLocalConfigPath(); - $this->settings = IniFileChainFactory::get(); + $this->settings = IniFileChainFactory::get($pathGlobal, $pathLocal, $pathCommon); } /** @@ -126,27 +126,30 @@ class Config extends Singleton $this->reload(); - $databaseTestsSettings = $this->__get('database_tests'); // has to be __get otherwise when called from TestConfig, PHP will issue a NOTICE + $databaseTestsSettings = $this->settings->get('database_tests'); // has to be __get otherwise when called from TestConfig, PHP will issue a NOTICE if (!empty($databaseTestsSettings)) { - $this->database = $databaseTestsSettings; + $this->settings->set('database', $databaseTestsSettings); } // Ensure local mods do not affect tests if (empty($pathGlobal)) { - $this->Debug = $this->settings->getFrom($this->pathGlobal, 'Debug'); - $this->mail = $this->settings->getFrom($this->pathGlobal, 'mail'); - $this->General = $this->settings->getFrom($this->pathGlobal, 'General'); - $this->Segments = $this->settings->getFrom($this->pathGlobal, 'Segments'); - $this->Tracker = $this->settings->getFrom($this->pathGlobal, 'Tracker'); - $this->Deletelogs = $this->settings->getFrom($this->pathGlobal, 'Deletelogs'); - $this->Deletereports = $this->settings->getFrom($this->pathGlobal, 'Deletereports'); - $this->Development = $this->settings->getFrom($this->pathGlobal, 'Development'); + $this->settings->set('Debug', $this->settings->getFrom($this->pathGlobal, 'Debug')); + $this->settings->set('mail', $this->settings->getFrom($this->pathGlobal, 'mail')); + $this->settings->set('General', $this->settings->getFrom($this->pathGlobal, 'General')); + $this->settings->set('Segments', $this->settings->getFrom($this->pathGlobal, 'Segments')); + $this->settings->set('Tracker', $this->settings->getFrom($this->pathGlobal, 'Tracker')); + $this->settings->set('Deletelogs', $this->settings->getFrom($this->pathGlobal, 'Deletelogs')); + $this->settings->set('Deletereports', $this->settings->getFrom($this->pathGlobal, 'Deletereports')); + $this->settings->set('Development', $this->settings->getFrom($this->pathGlobal, 'Development')); } // for unit tests, we set that no plugin is installed. This will force // the test initialization to create the plugins tables, execute ALTER queries, etc. - $this->PluginsInstalled = array('PluginsInstalled' => array()); + $this->settings->set('PluginsInstalled', array('PluginsInstalled' => array())); + } + protected function postConfigTestEvent() + { $allSettings =& $this->settings->getAll(); Piwik::postTestEvent('Config.createConfigSingleton', array($this, &$allSettings)); } @@ -280,6 +283,7 @@ class Config extends Singleton $this->pathLocal = $hostConfig['path']; $this->configLocal = array(); $this->initialized = false; + $this->reload(); return $this->pathLocal; } @@ -420,7 +424,7 @@ class Config extends Singleton public function &__get($name) { if (!$this->initialized) { - $this->reload(array($this->pathGlobal, $this->pathCommon), $this->pathLocal); + $this->postConfigTestEvent(); } $section =& $this->settings->get($name); |