Skip to content

Commit

Permalink
Clearing the config in init() which can be called multiple times
Browse files Browse the repository at this point in the history
  • Loading branch information
mattab committed Feb 20, 2015
1 parent 1504ebb commit ec9ba8d
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions core/Config.php
Original file line number Diff line number Diff line change
Expand Up @@ -126,8 +126,6 @@ public function setTestEnvironment($pathLocal = null, $pathGlobal = null, $pathC
$this->isTest = true;
}

$this->clear();

$this->pathLocal = $pathLocal ?: Config::getLocalConfigPath();
$this->pathGlobal = $pathGlobal ?: Config::getGlobalConfigPath();
$this->pathCommon = $pathCommon ?: Config::getCommonConfigPath();
Expand Down Expand Up @@ -281,8 +279,9 @@ public function forceUsageOfLocalHostnameConfig($hostname)
{
$hostConfig = self::getLocalConfigInfoForHostname($hostname);

if (!Filesystem::isValidFilename($hostConfig['file'])) {
throw new Exception('Hostname is not valid');
$filename = $hostConfig['file'];
if (!Filesystem::isValidFilename($filename)) {
throw new Exception('Piwik domain is not a valid looking hostname (' . $filename . ').');
}

$this->pathLocal = $hostConfig['path'];
Expand All @@ -308,6 +307,7 @@ public function clear()
{
$this->configGlobal = array();
$this->configLocal = array();
$this->configCommon = array();
$this->configCache = array();
$this->initialized = false;
}
Expand All @@ -319,6 +319,7 @@ public function clear()
*/
public function init()
{
$this->clear();
$this->initialized = true;
$reportError = SettingsServer::isTrackerApiRequest();

Expand Down

0 comments on commit ec9ba8d

Please sign in to comment.