Skip to content

Commit

Permalink
refs #6056 display a warning in admin to super users in case they are…
Browse files Browse the repository at this point in the history
… still using PHP 5.3
  • Loading branch information
tsteur committed Sep 23, 2014
1 parent d7315b1 commit 864f13a
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 1 deletion.
18 changes: 17 additions & 1 deletion core/Plugin/ControllerAdmin.php
Expand Up @@ -65,7 +65,7 @@ private static function notifyAnyInvalidPlugin()
$notification = new Notification($invalidPluginsWarning);
$notification->raw = true;
$notification->context = Notification::CONTEXT_WARNING;
$notification->title = Piwik::translate('General_Warning') . ':';
$notification->title = Piwik::translate('General_Warning');
Notification\Manager::notify('ControllerAdmin_InvalidPluginsWarning', $notification);
}

Expand Down Expand Up @@ -178,6 +178,16 @@ public static function setBasicVariablesAdminView(View $view)

self::checkPhpVersion($view);

if (Piwik::hasUserSuperUserAccess() && self::isPhpVersion53()) {
$notification = new Notification(Piwik::translate('General_WarningPhpVersionXIsTooOld', '5.3'));
$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('PHP53VersionCheck', $notification);
}

$adminMenu = MenuAdmin::getInstance()->getMenu();
$view->adminMenu = $adminMenu;

Expand Down Expand Up @@ -207,4 +217,10 @@ private static function checkPhpVersion($view)
$view->phpVersion = PHP_VERSION;
$view->phpIsNewEnough = version_compare($view->phpVersion, '5.3.0', '>=');
}

private static function isPhpVersion53()
{
return strpos(PHP_VERSION, '5.3') === 0;
}

}
1 change: 1 addition & 0 deletions lang/en.json
Expand Up @@ -428,6 +428,7 @@
"VisitType": "Visitor type",
"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.",
"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.",
Expand Down

0 comments on commit 864f13a

Please sign in to comment.