diff options
author | mattab <matthieu.aubry@gmail.com> | 2014-10-20 07:39:08 +0400 |
---|---|---|
committer | mattab <matthieu.aubry@gmail.com> | 2014-10-20 07:39:08 +0400 |
commit | d6535f96b03b55be31023cf1242ba73147826b76 (patch) | |
tree | 87b84d1ba4ab22021f7c88268e83667ef604b55e /core | |
parent | d6a86e8cb9bace90376bce2878ff2877c80f336a (diff) |
Refs #6470 Make it clear Piwik will stop supporting PHP 5.3 in May
Diffstat (limited to 'core')
-rw-r--r-- | core/Plugin/ControllerAdmin.php | 50 |
1 files changed, 32 insertions, 18 deletions
diff --git a/core/Plugin/ControllerAdmin.php b/core/Plugin/ControllerAdmin.php index e563e759f9..746395e88e 100644 --- a/core/Plugin/ControllerAdmin.php +++ b/core/Plugin/ControllerAdmin.php @@ -10,6 +10,7 @@ namespace Piwik\Plugin; use Piwik\Config as PiwikConfig; use Piwik\Config; +use Piwik\Date; use Piwik\Menu\MenuAdmin; use Piwik\Menu\MenuTop; use Piwik\Menu\MenuUser; @@ -124,17 +125,38 @@ abstract class ControllerAdmin extends Controller private static function notifyIfEAcceleratorIsUsed() { - if (self::$isEacceleratorUsed) { - $message = sprintf("You are using the PHP accelerator & optimizer eAccelerator which is known to be not compatible with Piwik. - We have disabled eAccelerator, which might affect the performance of Piwik. - Read the %srelated ticket%s for more information and how to fix this problem.", - '<a target="_blank" href="https://github.com/piwik/piwik/issues/4439">', '</a>'); + if (!self::$isEacceleratorUsed) { + return; + } + $message = sprintf("You are using the PHP accelerator & optimizer eAccelerator which is known to be not compatible with Piwik. + We have disabled eAccelerator, which might affect the performance of Piwik. + Read the %srelated ticket%s for more information and how to fix this problem.", + '<a target="_blank" href="https://github.com/piwik/piwik/issues/4439">', '</a>'); - $notification = new Notification($message); - $notification->context = Notification::CONTEXT_WARNING; - $notification->raw = true; - Notification\Manager::notify('ControllerAdmin_EacceleratorIsUsed', $notification); + $notification = new Notification($message); + $notification->context = Notification::CONTEXT_WARNING; + $notification->raw = true; + Notification\Manager::notify('ControllerAdmin_EacceleratorIsUsed', $notification); + } + + private static function notifyWhenPhpVersionIsEOL() + { + $notifyPhpIsEOL = Piwik::hasUserSuperUserAccess() && self::isPhpVersion53(); + if (!$notifyPhpIsEOL) { + return; } + $dateDropSupport = Date::factory('2015-05-01')->getLocalized('%longMonth% %longYear%'); + $message = Piwik::translate('General_WarningPiwikWillStopSupportingPHPVersion', $dateDropSupport) + . "\n " + . Piwik::translate('General_WarningPhpVersionXIsTooOld', '5.3'); + + $notification = new Notification($message); + $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); } /** @@ -183,15 +205,7 @@ abstract class ControllerAdmin extends Controller 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); - } + self::notifyWhenPhpVersionIsEOL(); $adminMenu = MenuAdmin::getInstance()->getMenu(); $view->adminMenu = $adminMenu; |