diff options
author | Thomas Steur <tsteur@users.noreply.github.com> | 2015-11-04 22:51:51 +0300 |
---|---|---|
committer | Thomas Steur <tsteur@users.noreply.github.com> | 2015-11-04 22:51:51 +0300 |
commit | 71c972da727f1f97c5fc13eb491daa77ff516de6 (patch) | |
tree | 9b07fbdcded0f3aa043d184f42422d06e9cd6854 /core | |
parent | ac169f0014b966fa59b0e8efc26fe7d2d4c136fb (diff) | |
parent | 45e7d1e860ee25852db28b926143fc1cdfed5940 (diff) |
Merge pull request #9144 from piwik/notification_old_php
when PHP is 5.4, display a warning message notifying users to upgrade to PHP 5.5
Diffstat (limited to 'core')
-rw-r--r-- | core/Plugin/ControllerAdmin.php | 23 |
1 files changed, 19 insertions, 4 deletions
diff --git a/core/Plugin/ControllerAdmin.php b/core/Plugin/ControllerAdmin.php index 42f44706b1..6ecca10243 100644 --- a/core/Plugin/ControllerAdmin.php +++ b/core/Plugin/ControllerAdmin.php @@ -124,13 +124,23 @@ abstract class ControllerAdmin extends Controller private static function notifyWhenPhpVersionIsEOL() { - $notifyPhpIsEOL = Piwik::hasUserSuperUserAccess() && self::isPhpVersion53(); + $deprecatedMajorPhpVersion = null; + if(self::isPhpVersion53()) { + $deprecatedMajorPhpVersion = '5.3'; + } elseif(self::isPhpVersion54()) { + $deprecatedMajorPhpVersion = '5.4'; + } + + $notifyPhpIsEOL = Piwik::hasUserSuperUserAccess() && $deprecatedMajorPhpVersion; if (!$notifyPhpIsEOL) { return; } - $message = Piwik::translate('General_WarningPiwikWillStopSupportingPHPVersion') + + $nextRequiredMinimumPHP = '5.5'; + + $message = Piwik::translate('General_WarningPiwikWillStopSupportingPHPVersion', array($deprecatedMajorPhpVersion, $nextRequiredMinimumPHP)) . "\n " - . Piwik::translate('General_WarningPhpVersionXIsTooOld', '5.3'); + . Piwik::translate('General_WarningPhpVersionXIsTooOld', $deprecatedMajorPhpVersion); $notification = new Notification($message); $notification->title = Piwik::translate('General_Warning'); @@ -138,7 +148,7 @@ abstract class ControllerAdmin extends Controller $notification->context = Notification::CONTEXT_WARNING; $notification->type = Notification::TYPE_TRANSIENT; $notification->flags = Notification::FLAG_NO_CLEAR; - NotificationManager::notify('PHP53VersionCheck', $notification); + NotificationManager::notify('DeprecatedPHPVersionCheck', $notification); } private static function notifyWhenDebugOnDemandIsEnabled($trackerSetting) @@ -243,4 +253,9 @@ abstract class ControllerAdmin extends Controller { return strpos(PHP_VERSION, '5.3') === 0; } + + private static function isPhpVersion54() + { + return strpos(PHP_VERSION, '5.4') === 0; + } } |