diff options
author | mattab <matthieu.aubry@gmail.com> | 2015-11-02 05:05:06 +0300 |
---|---|---|
committer | mattab <matthieu.aubry@gmail.com> | 2015-11-02 05:05:06 +0300 |
commit | a6392f3e3c4c14f91297ead582e03a2c9b7b2727 (patch) | |
tree | 44604f6d3dafd3cd581e19a5f10f4e30631837bc | |
parent | f888b0852a4c76681a12a4cfcf4a24f488f249f9 (diff) |
when PHP is 5.4, display a warning message in a notification, and ask users to upgrade to PHP 5.5
https://github.com/piwik/piwik/issues/8156
https://github.com/piwik/piwik/issues/8193
-rw-r--r-- | core/Plugin/ControllerAdmin.php | 24 | ||||
-rw-r--r-- | lang/en.json | 2 |
2 files changed, 21 insertions, 5 deletions
diff --git a/core/Plugin/ControllerAdmin.php b/core/Plugin/ControllerAdmin.php index 42f44706b1..8560d74ec4 100644 --- a/core/Plugin/ControllerAdmin.php +++ b/core/Plugin/ControllerAdmin.php @@ -124,13 +124,24 @@ abstract class ControllerAdmin extends Controller private static function notifyWhenPhpVersionIsEOL() { - $notifyPhpIsEOL = Piwik::hasUserSuperUserAccess() && self::isPhpVersion53(); + $isDeprecatedPhp = (self::isPhpVersion53() || self::isPhpVersion54()); + $notifyPhpIsEOL = Piwik::hasUserSuperUserAccess() && $isDeprecatedPhp; if (!$notifyPhpIsEOL) { return; } - $message = Piwik::translate('General_WarningPiwikWillStopSupportingPHPVersion') + + $nextRequiredMinimumPHP = '5.5'; + + $majorPhpVersion = null; + if(self::isPhpVersion53()) { + $majorPhpVersion = '5.3'; + } elseif(self::isPhpVersion54()) { + $majorPhpVersion = '5.4'; + } + + $message = Piwik::translate('General_WarningPiwikWillStopSupportingPHPVersion', array($majorPhpVersion, $nextRequiredMinimumPHP)) . "\n " - . Piwik::translate('General_WarningPhpVersionXIsTooOld', '5.3'); + . Piwik::translate('General_WarningPhpVersionXIsTooOld', $majorPhpVersion); $notification = new Notification($message); $notification->title = Piwik::translate('General_Warning'); @@ -138,7 +149,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 +254,9 @@ abstract class ControllerAdmin extends Controller { return strpos(PHP_VERSION, '5.3') === 0; } + + private static function isPhpVersion54() + { + return strpos(PHP_VERSION, '5.4') === 0; + } } diff --git a/lang/en.json b/lang/en.json index c525d49631..615ad706c0 100644 --- a/lang/en.json +++ b/lang/en.json @@ -385,7 +385,7 @@ "VisitTypeExample": "For example, to select all visitors who have returned to the website, including those who have bought something in their previous visits, the API request would contain %s", "Warning": "Warning", "WarningPhpVersionXIsTooOld": "The PHP version %s you are using has reached its End of Life (EOL). You are strongly urged to upgrade to a current version, as using this version may expose you to security vulnerabilities and bugs that have been fixed in more recent versions of PHP.", - "WarningPiwikWillStopSupportingPHPVersion": "Piwik will stop supporting PHP 5.3 in the next major version. Upgrade your PHP version before it's too late!", + "WarningPiwikWillStopSupportingPHPVersion": "Piwik will stop supporting PHP %1$s in the next major version. Upgrade your PHP to at least PHP %2$s, before it's too late!", "WarningFileIntegrityNoManifest": "File integrity check could not be performed due to missing manifest.inc.php.", "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.", |