Skip to content
Extraits de code Groupes Projets
Valider 71c972da rédigé par Thomas Steur's avatar Thomas Steur
Parcourir les fichiers

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
parents ac169f00 45e7d1e8
Aucune branche associée trouvée
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
...@@ -124,13 +124,23 @@ abstract class ControllerAdmin extends Controller ...@@ -124,13 +124,23 @@ abstract class ControllerAdmin extends Controller
private static function notifyWhenPhpVersionIsEOL() 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) { if (!$notifyPhpIsEOL) {
return; return;
} }
$message = Piwik::translate('General_WarningPiwikWillStopSupportingPHPVersion')
$nextRequiredMinimumPHP = '5.5';
$message = Piwik::translate('General_WarningPiwikWillStopSupportingPHPVersion', array($deprecatedMajorPhpVersion, $nextRequiredMinimumPHP))
. "\n " . "\n "
. Piwik::translate('General_WarningPhpVersionXIsTooOld', '5.3'); . Piwik::translate('General_WarningPhpVersionXIsTooOld', $deprecatedMajorPhpVersion);
$notification = new Notification($message); $notification = new Notification($message);
$notification->title = Piwik::translate('General_Warning'); $notification->title = Piwik::translate('General_Warning');
...@@ -138,7 +148,7 @@ abstract class ControllerAdmin extends Controller ...@@ -138,7 +148,7 @@ abstract class ControllerAdmin extends Controller
$notification->context = Notification::CONTEXT_WARNING; $notification->context = Notification::CONTEXT_WARNING;
$notification->type = Notification::TYPE_TRANSIENT; $notification->type = Notification::TYPE_TRANSIENT;
$notification->flags = Notification::FLAG_NO_CLEAR; $notification->flags = Notification::FLAG_NO_CLEAR;
NotificationManager::notify('PHP53VersionCheck', $notification); NotificationManager::notify('DeprecatedPHPVersionCheck', $notification);
} }
private static function notifyWhenDebugOnDemandIsEnabled($trackerSetting) private static function notifyWhenDebugOnDemandIsEnabled($trackerSetting)
...@@ -243,4 +253,9 @@ abstract class ControllerAdmin extends Controller ...@@ -243,4 +253,9 @@ abstract class ControllerAdmin extends Controller
{ {
return strpos(PHP_VERSION, '5.3') === 0; return strpos(PHP_VERSION, '5.3') === 0;
} }
private static function isPhpVersion54()
{
return strpos(PHP_VERSION, '5.4') === 0;
}
} }
...@@ -385,7 +385,7 @@ ...@@ -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", "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", "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.", "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.", "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.", "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.", "WarningFileIntegrityNoMd5file": "File integrity check could not be completed due to missing md5_file() function.",
......
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
} }
// hide PHP is deprecated notification in UI test // hide PHP is deprecated notification in UI test
.uiTest [notification-id="PHP53VersionCheck"] { .uiTest [notification-id="DeprecatedPHPVersionCheck"] {
display: none !important; display: none !important;
} }
......
0% Chargement en cours ou .
You are about to add 0 people to the discussion. Proceed with caution.
Terminez d'abord l'édition de ce message.
Veuillez vous inscrire ou vous pour commenter