Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/matomo-org/matomo.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'core/Plugin/ControllerAdmin.php')
-rw-r--r--core/Plugin/ControllerAdmin.php54
1 files changed, 38 insertions, 16 deletions
diff --git a/core/Plugin/ControllerAdmin.php b/core/Plugin/ControllerAdmin.php
index e503a615e6..f24246944f 100644
--- a/core/Plugin/ControllerAdmin.php
+++ b/core/Plugin/ControllerAdmin.php
@@ -153,6 +153,42 @@ abstract class ControllerAdmin extends Controller
Notification\Manager::notify('ControllerAdmin_EacceleratorIsUsed', $notification);
}
+ /**
+ * PHP Version required by the next major Piwik version
+ * @return string
+ */
+ private static function getNextRequiredMinimumPHP()
+ {
+ return '5.5.9';
+ }
+
+ private static function isUsingPhpVersionCompatibleWithNextPiwik()
+ {
+ return version_compare( PHP_VERSION, self::getNextRequiredMinimumPHP(), '>=' );
+ }
+
+ private static function notifyWhenPhpVersionIsNotCompatibleWithNextMajorPiwik()
+ {
+ if(self::isUsingPhpVersionCompatibleWithNextPiwik()) {
+ return;
+ }
+
+ $youMustUpgradePHP = Piwik::translate('General_YouMustUpgradePhpVersionToReceiveLatestPiwik');
+ $message = Piwik::translate('General_PiwikCannotBeUpgradedBecausePhpIsTooOld')
+ . ' '
+ . sprintf(Piwik::translate('General_PleaseUpgradeYourPhpVersionSoYourPiwikDataStaysSecure'), self::getNextRequiredMinimumPHP())
+ ;
+
+ $notification = new Notification($message);
+ $notification->title = $youMustUpgradePHP;
+ $notification->priority = Notification::PRIORITY_LOW;
+ $notification->context = Notification::CONTEXT_WARNING;
+ $notification->type = Notification::TYPE_TRANSIENT;
+ $notification->flags = Notification::FLAG_NO_CLEAR;
+ NotificationManager::notify('PHPVersionTooOldForNewestPiwikCheck', $notification);
+ }
+
+
private static function notifyWhenPhpVersionIsEOL()
{
$deprecatedMajorPhpVersion = null;
@@ -167,9 +203,7 @@ abstract class ControllerAdmin extends Controller
return;
}
- $nextRequiredMinimumPHP = '5.5';
-
- $message = Piwik::translate('General_WarningPiwikWillStopSupportingPHPVersion', array($deprecatedMajorPhpVersion, $nextRequiredMinimumPHP))
+ $message = Piwik::translate('General_WarningPiwikWillStopSupportingPHPVersion', array($deprecatedMajorPhpVersion, self::getNextRequiredMinimumPHP()))
. "\n "
. Piwik::translate('General_WarningPhpVersionXIsTooOld', $deprecatedMajorPhpVersion);
@@ -243,10 +277,8 @@ abstract class ControllerAdmin extends Controller
$view->isSuperUser = Piwik::hasUserSuperUserAccess();
self::notifyAnyInvalidPlugin();
-
- self::checkPhpVersion($view);
-
self::notifyWhenPhpVersionIsEOL();
+ self::notifyWhenPhpVersionIsNotCompatibleWithNextMajorPiwik();
self::notifyWhenDebugOnDemandIsEnabled('debug');
self::notifyWhenDebugOnDemandIsEnabled('debug_on_demand');
@@ -271,16 +303,6 @@ abstract class ControllerAdmin extends Controller
return "Piwik " . Version::VERSION;
}
- /**
- * Check if the current PHP version is >= 5.3. If not, a warning is displayed
- * to the user.
- */
- 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;