From 30ac0fa4fa87e454bf1a02fd5fd634b09eb8b00b Mon Sep 17 00:00:00 2001
From: mattab <matthieu.aubry@gmail.com>
Date: Tue, 18 Feb 2014 15:40:03 +1300
Subject: [PATCH] Always report an error if config file not writable. Not sure
 where this logic came from...

---
 core/Config.php | 14 +++++---------
 1 file changed, 5 insertions(+), 9 deletions(-)

diff --git a/core/Config.php b/core/Config.php
index cd0e11b82c..1666b754a7 100644
--- a/core/Config.php
+++ b/core/Config.php
@@ -260,26 +260,22 @@ class Config extends Singleton
     public function init()
     {
         $this->initialized = true;
-        $reportError = !empty($GLOBALS['PIWIK_TRACKER_MODE']);
 
         // read defaults from global.ini.php
-        if (!is_readable($this->pathGlobal) && $reportError) {
+        if (!is_readable($this->pathGlobal)) {
             Piwik_ExitWithMessage(Piwik::translate('General_ExceptionConfigurationFileNotFound', array($this->pathGlobal)));
         }
 
         $this->configGlobal = _parse_ini_file($this->pathGlobal, true);
-
-        if (empty($this->configGlobal) && $reportError) {
+        if (empty($this->configGlobal)) {
             Piwik_ExitWithMessage(Piwik::translate('General_ExceptionUnreadableFileDisabledMethod', array($this->pathGlobal, "parse_ini_file()")));
         }
 
         $this->configCommon = _parse_ini_file($this->pathCommon, true);
 
-        if ($reportError) {
-            $this->checkLocalConfigFound();
-        }
+        $this->checkLocalConfigFound();
         $this->configLocal = _parse_ini_file($this->pathLocal, true);
-        if (empty($this->configLocal) && $reportError) {
+        if (empty($this->configLocal)) {
             Piwik_ExitWithMessage(Piwik::translate('General_ExceptionUnreadableFileDisabledMethod', array($this->pathLocal, "parse_ini_file()")));
         }
     }
@@ -292,7 +288,7 @@ class Config extends Singleton
     public function checkLocalConfigFound()
     {
         if (!$this->existsLocalConfig()) {
-            throw new Exception(Piwik::translate('General_ExceptionConfigurationFileNotFound', array($this->pathLocal)));
+            Piwik_ExitWithMessage(Piwik::translate('General_ExceptionConfigurationFileNotFound', array($this->pathLocal)));
         }
     }
 
-- 
GitLab