diff --git a/config/global.ini.php b/config/global.ini.php index f0f8367d9f3..bf9498e8ac4 100644 --- a/config/global.ini.php +++ b/config/global.ini.php @@ -133,6 +133,8 @@ disable_merged_assets = 0 [General] +; If enabled, shows a warning to users that current version is outdated +show_piwik2_end_of_life_warning = 1 ; the following settings control whether Unique Visitors `nb_uniq_visitors` and Unique users `nb_users` will be processed for different period types. ; year and range periods are disabled by default, to ensure optimal performance for high traffic Piwik instances diff --git a/core/Plugin/Controller.php b/core/Plugin/Controller.php index e6a21fd6f41..d410146dd70 100644 --- a/core/Plugin/Controller.php +++ b/core/Plugin/Controller.php @@ -642,6 +642,8 @@ protected function setGeneralVariablesView($view) $view->topMenu = MenuTop::getInstance()->getMenu(); $view->userMenu = MenuUser::getInstance()->getMenu(); + ControllerAdmin::notifyPiwik2EndOfLife(); + $notifications = $view->notifications; if (empty($notifications)) { $view->notifications = NotificationManager::getAllNotificationsToDisplay(); diff --git a/core/Plugin/ControllerAdmin.php b/core/Plugin/ControllerAdmin.php index fbf84aa06a6..276e06557e7 100644 --- a/core/Plugin/ControllerAdmin.php +++ b/core/Plugin/ControllerAdmin.php @@ -8,6 +8,7 @@ */ namespace Piwik\Plugin; +use Piwik\Common; use Piwik\Config as PiwikConfig; use Piwik\Config; use Piwik\Container\StaticContainer; @@ -18,6 +19,7 @@ use Piwik\Notification; use Piwik\Notification\Manager as NotificationManager; use Piwik\Piwik; +use Piwik\Plugin; use Piwik\Plugins\Marketplace\Marketplace; use Piwik\Tracker\TrackerConfig; use Piwik\Url; @@ -213,6 +215,47 @@ private static function isUsingPhpVersionCompatibleWithNextPiwik() return version_compare( PHP_VERSION, self::getNextRequiredMinimumPHP(), '>=' ); } + public static function notifyPiwik2EndOfLife() + { + if (Piwik::isUserIsAnonymous()) { + return; + } + + if (!Piwik::isUserHasSomeViewAccess()) { + return; + } + + $general = Config::getInstance()->General; + if (empty($general['show_piwik2_end_of_life_warning'])) { + return; + } + + if (Piwik::getModule() === 'CoreHome' && Piwik::getAction() === 'piwikIsOutdated') { + return; + } + + if (Piwik::getLoginPluginName() === Piwik::getModule()) { + return; + } + + if (Common::getRequestVar('widget', 0,'int') === 1) { + return; + } + + if (Plugin\Manager::getInstance()->isPluginActivated('WhiteLabel')) { + return; + } + + $message = 'Piwik 2 is no longer supported and does not receive any security updates anymore.
Learn more about how to make your Piwik secure again.'; + $notification = new Notification($message); + $notification->raw = true; + $notification->context = Notification::CONTEXT_ERROR; + $notification->title = 'This version of Piwik is outdated and not supported anymore.'; + Notification\Manager::notify('ControllerAdmin_EndOfLife', $notification); + } + private static function notifyWhenPhpVersionIsNotCompatibleWithNextMajorPiwik() { if(self::isUsingPhpVersionCompatibleWithNextPiwik()) { @@ -322,6 +365,7 @@ public static function setBasicVariablesAdminView(View $view) $view->isSuperUser = Piwik::hasUserSuperUserAccess(); + self::notifyPiwik2EndOfLife(); self::notifyAnyInvalidLicense(); self::notifyAnyInvalidPlugin(); self::notifyWhenPhpVersionIsEOL(); @@ -329,6 +373,8 @@ public static function setBasicVariablesAdminView(View $view) self::notifyWhenDebugOnDemandIsEnabled('debug'); self::notifyWhenDebugOnDemandIsEnabled('debug_on_demand'); + + $adminMenu = MenuAdmin::getInstance()->getMenu(); $view->adminMenu = $adminMenu; diff --git a/plugins/CoreHome/Controller.php b/plugins/CoreHome/Controller.php index 8552a2df59f..1208350b925 100644 --- a/plugins/CoreHome/Controller.php +++ b/plugins/CoreHome/Controller.php @@ -49,6 +49,14 @@ public function getDefaultAction() return 'redirectToCoreHomeIndex'; } + public function piwikIsOutdated() + { + Piwik::checkUserIsNotAnonymous(); + Piwik::checkUserHasSomeViewAccess(); + + return $this->renderTemplate('piwikIsOutdated'); + } + public function renderReportMenu(Report $report) { Piwik::checkUserHasSomeViewAccess(); diff --git a/plugins/CoreHome/images/piwik3.png b/plugins/CoreHome/images/piwik3.png new file mode 100644 index 00000000000..b9f43c34fac Binary files /dev/null and b/plugins/CoreHome/images/piwik3.png differ diff --git a/plugins/CoreHome/templates/piwikIsOutdated.twig b/plugins/CoreHome/templates/piwikIsOutdated.twig new file mode 100644 index 00000000000..4e97ab3081c --- /dev/null +++ b/plugins/CoreHome/templates/piwikIsOutdated.twig @@ -0,0 +1,60 @@ +{% extends 'dashboard.twig' %} + +{% block topcontrols %} +
+
+{% endblock %} + +{% block content %} +
+ +
+

Your Piwik is outdated and insecure. Upgrade now to Matomo 3, the most efficient and secure Matomo version

+

You are using Piwik 2 which is no longer supported since December 2017. This means your Piwik will no longer receive any updates or security fixes and therefore this version is considered insecure.

+ +

Piwik is now Matomo

+

+ You may be surprised, but no stress, take a deep breath, it is only our name that changed and nothing else. + In January 2018 we have renamed Piwik to Matomo. Learn more +

+ +

What is new in Matomo 3?

+

+ + In December 2016, we have released Piwik 3.0 which brings heaps of awesome new features, a new improved user interface, and lots of performance and security improvements. + Since then, many new major updates have been released that further improve the security and performance and bring new features such as a GDPR manager, a revamped user management, cross domain tracking, and hundreds of other new features. +

+ Matomo 3 also supports premium features which are made directly by the makers of Piwik/Matomo:
+ Custom Reports, Heatmaps & Session Recordings, Search Engine Keywords Performance, Funnels, A/B Testing, Roll-Up Reporting, Users Flow, Form Analytics, Media Analytics, Multi Channel Conversion Attribution, and more. + +

+ +

How to upgrade

+

The update to Matomo (Piwik) 3 should be smooth, but may take a while depending on the amount of data you have. If you have any problem with the update, feel free to get in touch with us. At Matomo and at InnoCraft, the company of the makers of Matomo, we have successfully updated many Matomo installations.

+

If your server meets the requirements for Matomo 3, you can upgrade your Piwik with our automatic updater. + If not, you may need to upgrade your server before you can update to the latest server version. +

+ +

Don't want the hassle of updating and maintaining your Piwik? Migrate to the Matomo Analytics Cloud

+

+ We can migrate your Piwik database to our Matomo Analytics Cloud without the loss of any data while you keep 100% data ownership.
+ The Cloud is operated directly by the makers of Piwik/Matomo and is reliable, secure, comes with bonus features, and always kept up to date. +

+ Learn more about the Matomo Analytics Cloud
+ View Pricing
+ Get in touch with our support team to learn more about the migration
+

+ + {% if isSuperUser %} +

Want to disable this warning? (not recommended)

+

+ A user with access to the server can edit the config/config.ini.php file and add the following lines (the line with [General] may already exist): +
+
+

[General]
+show_piwik2_end_of_life_warning = 0
+

+ {% endif %} +
+
+{% endblock %} diff --git a/tests/UI/specs/UIIntegration_spec.js b/tests/UI/specs/UIIntegration_spec.js index 97ea69678c2..6d2a4cc0ac0 100644 --- a/tests/UI/specs/UIIntegration_spec.js +++ b/tests/UI/specs/UIIntegration_spec.js @@ -43,6 +43,12 @@ describe("UIIntegrationTest", function () { // TODO: Rename to Piwik? testEnvironment.save(); }); + it("should show a notification piwik is oudated", function (done) { + expect.screenshot("piwikisoutdated").to.be.captureSelector('.pageWrap', function (page) { + page.load("?module=CoreHome&action=piwikIsOutdated&idSite=1&period=day&date=today"); + }, done); + }); + // dashboard tests it("should load dashboard1 correctly", function (done) { expect.screenshot("dashboard1").to.be.captureSelector('.pageWrap,.expandDataTableFooterDrawer', function (page) {