diff options
author | Thomas Steur <thomas.steur@gmail.com> | 2015-09-04 11:20:21 +0300 |
---|---|---|
committer | Thomas Steur <thomas.steur@gmail.com> | 2015-09-04 11:21:32 +0300 |
commit | ba7ca7767de55da3f3a089373ec611455731a9e5 (patch) | |
tree | 394024adb540e8c70365c3f177a74b72297158e5 | |
parent | c63ac672b6495f3c50583746a9b5781e223a7991 (diff) |
show warning if debugging on demand is enabled
-rw-r--r-- | core/Plugin/ControllerAdmin.php | 21 | ||||
-rw-r--r-- | lang/en.json | 1 |
2 files changed, 22 insertions, 0 deletions
diff --git a/core/Plugin/ControllerAdmin.php b/core/Plugin/ControllerAdmin.php index c82fcaf92b..cf9a9888be 100644 --- a/core/Plugin/ControllerAdmin.php +++ b/core/Plugin/ControllerAdmin.php @@ -11,12 +11,14 @@ namespace Piwik\Plugin; use Piwik\Config as PiwikConfig; use Piwik\Config; use Piwik\Date; +use Piwik\Development; use Piwik\Menu\MenuAdmin; use Piwik\Menu\MenuTop; use Piwik\Menu\MenuUser; use Piwik\Notification; use Piwik\Notification\Manager as NotificationManager; use Piwik\Piwik; +use Piwik\Tracker\TrackerConfig; use Piwik\Url; use Piwik\Version; use Piwik\View; @@ -140,6 +142,24 @@ abstract class ControllerAdmin extends Controller NotificationManager::notify('PHP53VersionCheck', $notification); } + private static function notifyWhenDebugOnDemandIsEnabled() + { + if (!Development::isEnabled() + && Piwik::hasUserSuperUserAccess() && + TrackerConfig::getConfigValue('debug_on_demand')) { + + $message = Piwik::translate('General_WarningDebugOnDemandEnabled'); + $message = sprintf($message, '"[Tracker]debug_on_demand"', '"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); + } + } + /** * Assigns view properties that would be useful to views that render admin pages. * @@ -185,6 +205,7 @@ abstract class ControllerAdmin extends Controller self::checkPhpVersion($view); self::notifyWhenPhpVersionIsEOL(); + self::notifyWhenDebugOnDemandIsEnabled(); $adminMenu = MenuAdmin::getInstance()->getMenu(); $view->adminMenu = $adminMenu; diff --git a/lang/en.json b/lang/en.json index 99beab0949..01c5ed18f1 100644 --- a/lang/en.json +++ b/lang/en.json @@ -388,6 +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", "Website": "Website", "Weekly": "Weekly", "WeeklyReport": "weekly", |