From a38c3e0d3e8dc0220c00d2c4ec89acede58885a0 Mon Sep 17 00:00:00 2001
From: Thomas Steur <thomas.steur@gmail.com>
Date: Fri, 4 Sep 2015 08:43:20 +0000
Subject: [PATCH] also show warning if tracker debug is enabled

---
 core/Plugin/ControllerAdmin.php | 12 +++++++-----
 lang/en.json                    |  2 +-
 2 files changed, 8 insertions(+), 6 deletions(-)

diff --git a/core/Plugin/ControllerAdmin.php b/core/Plugin/ControllerAdmin.php
index cf9a9888be..f17abe7141 100644
--- a/core/Plugin/ControllerAdmin.php
+++ b/core/Plugin/ControllerAdmin.php
@@ -142,21 +142,22 @@ abstract class ControllerAdmin extends Controller
         NotificationManager::notify('PHP53VersionCheck', $notification);
     }
 
-    private static function notifyWhenDebugOnDemandIsEnabled()
+    private static function notifyWhenDebugOnDemandIsEnabled($trackerSetting)
     {
         if (!Development::isEnabled()
             && Piwik::hasUserSuperUserAccess() &&
-            TrackerConfig::getConfigValue('debug_on_demand')) {
+            TrackerConfig::getConfigValue($trackerSetting)) {
 
             $message = Piwik::translate('General_WarningDebugOnDemandEnabled');
-            $message = sprintf($message, '"[Tracker]debug_on_demand"', '"0"', '"config/config.ini.php"');
+            $message = sprintf($message, '"' . $trackerSetting . '"', '"[Tracker]' .  $trackerSetting . '"', '"0"',
+                                               '"config/config.ini.php"');
             $notification = new Notification($message);
             $notification->title = Piwik::translate('General_Warning');
             $notification->priority = Notification::PRIORITY_LOW;
             $notification->context = Notification::CONTEXT_WARNING;
             $notification->type = Notification::TYPE_TRANSIENT;
             $notification->flags = Notification::FLAG_NO_CLEAR;
-            NotificationManager::notify('DebugOnDemand', $notification);
+            NotificationManager::notify('Tracker' . $trackerSetting, $notification);
         }
     }
 
@@ -205,7 +206,8 @@ abstract class ControllerAdmin extends Controller
         self::checkPhpVersion($view);
 
         self::notifyWhenPhpVersionIsEOL();
-        self::notifyWhenDebugOnDemandIsEnabled();
+        self::notifyWhenDebugOnDemandIsEnabled('debug');
+        self::notifyWhenDebugOnDemandIsEnabled('debug_on_demand');
 
         $adminMenu = MenuAdmin::getInstance()->getMenu();
         $view->adminMenu = $adminMenu;
diff --git a/lang/en.json b/lang/en.json
index 01c5ed18f1..8a3b9df0fc 100644
--- a/lang/en.json
+++ b/lang/en.json
@@ -388,7 +388,7 @@
         "WarningFileIntegrityNoManifestDeployingFromGit": "If you are deploying Piwik from Git, this message is normal.",
         "WarningFileIntegrityNoMd5file": "File integrity check could not be completed due to missing md5_file() function.",
         "WarningPasswordStored": "%sWarning:%s This password will be stored in the config file visible to everybody who can access it.",
-        "WarningDebugOnDemandEnabled": "Debugging Tracker on demand is enabled. For security reasons this should be enabled only for a short time frame. To disable it set %s to %s in %s",
+        "WarningDebugOnDemandEnabled": "Tracker %s mode is enabled. For security reasons this should be enabled only for a short time frame. To disable it set %s to %s in %s",
         "Website": "Website",
         "Weekly": "Weekly",
         "WeeklyReport": "weekly",
-- 
GitLab