diff options
author | Thomas Steur <tsteur@users.noreply.github.com> | 2018-12-06 06:07:27 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-12-06 06:07:27 +0300 |
commit | 5596f77cf7fef8664ab9fe476f5b2f61a435faf0 (patch) | |
tree | c208cdf54763b53044680c431c5ea4b3b1fa6ee7 | |
parent | 3b16730be5863916453fdea66a4af9555d25ea07 (diff) |
Mention Piwik 2 is no longer supported (Piwik 2.18) (#13448)
* Mention Piwik 2 is no longer supported
* add image
* Update ControllerAdmin.php
* Update Controller.php
* do not show it for anonymous
-rw-r--r-- | config/global.ini.php | 2 | ||||
-rw-r--r-- | core/Plugin/Controller.php | 2 | ||||
-rw-r--r-- | core/Plugin/ControllerAdmin.php | 46 | ||||
-rw-r--r-- | plugins/CoreHome/Controller.php | 8 | ||||
-rw-r--r-- | plugins/CoreHome/images/piwik3.png | bin | 0 -> 156085 bytes | |||
-rw-r--r-- | plugins/CoreHome/templates/piwikIsOutdated.twig | 60 | ||||
-rw-r--r-- | tests/UI/specs/UIIntegration_spec.js | 6 |
7 files changed, 124 insertions, 0 deletions
diff --git a/config/global.ini.php b/config/global.ini.php index f0f8367d9f..bf9498e8ac 100644 --- a/config/global.ini.php +++ b/config/global.ini.php @@ -133,6 +133,8 @@ enabled = 0 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 e6a21fd6f4..d410146dd7 100644 --- a/core/Plugin/Controller.php +++ b/core/Plugin/Controller.php @@ -642,6 +642,8 @@ abstract class Controller $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 fbf84aa06a..276e06557e 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\Menu\MenuUser; 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 @@ abstract class ControllerAdmin extends Controller 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.<br /><a href="'; + $message .= 'index.php' . Url::getCurrentQueryStringWithParametersModified(array('module' => 'CoreHome', 'action' => 'piwikIsOutdated')); + $message .= '">Learn more about how to make your Piwik secure again.</a>'; + $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 @@ abstract class ControllerAdmin extends Controller $view->isSuperUser = Piwik::hasUserSuperUserAccess(); + self::notifyPiwik2EndOfLife(); self::notifyAnyInvalidLicense(); self::notifyAnyInvalidPlugin(); self::notifyWhenPhpVersionIsEOL(); @@ -329,6 +373,8 @@ abstract class ControllerAdmin extends Controller 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 8552a2df59..1208350b92 100644 --- a/plugins/CoreHome/Controller.php +++ b/plugins/CoreHome/Controller.php @@ -49,6 +49,14 @@ class Controller extends \Piwik\Plugin\Controller 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 Binary files differnew file mode 100644 index 0000000000..b9f43c34fa --- /dev/null +++ b/plugins/CoreHome/images/piwik3.png diff --git a/plugins/CoreHome/templates/piwikIsOutdated.twig b/plugins/CoreHome/templates/piwikIsOutdated.twig new file mode 100644 index 0000000000..4e97ab3081 --- /dev/null +++ b/plugins/CoreHome/templates/piwikIsOutdated.twig @@ -0,0 +1,60 @@ +{% extends 'dashboard.twig' %} + +{% block topcontrols %} + <div class="top_controls"> + </div> +{% endblock %} + +{% block content %} + <div class="container" id="multisites"> + + <div id="main"> + <h1>Your Piwik is outdated and insecure. Upgrade now to Matomo 3, the most efficient and secure Matomo version</h1> + <p>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.</p> + + <h2>Piwik is now Matomo</h2> + <p> + 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 <strong>Piwik to Matomo</strong>. <a href="https://matomo.org/blog/2018/01/piwik-is-now-matomo">Learn more</a> + </p> + + <h2>What is new in Matomo 3?</h2> + <p> + <img align="right" src="plugins/CoreHome/images/piwik3.png" width="350" style="margin-left: 20px;"> + In December 2016, we have released <a href="https://matomo.org/changelog/piwik-3-0-0/">Piwik 3.0</a> which brings heaps of awesome new features, a new improved user interface, and lots of performance and security improvements. + Since then, many <a href="https://matomo.org/changelog/">new major updates have been released</a> 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. + <br /><br /> + Matomo 3 also supports premium features which are made directly by the makers of Piwik/Matomo:<br /> + <a href="https://plugins.matomo.org/CustomReports">Custom Reports</a>, <a href="https://plugins.matomo.org/HeatmapSessionRecording">Heatmaps & Session Recordings</a>, <a href="https://plugins.matomo.org/SearchEngineKeywordsPerformance">Search Engine Keywords Performance</a>, <a href="https://plugins.matomo.org/Funnels">Funnels</a>, <a href="https://plugins.matomo.org/AbTesting">A/B Testing</a>, <a href="https://plugins.matomo.org/RollUpReporting">Roll-Up Reporting</a>, <a href="https://plugins.matomo.org/UsersFlow">Users Flow</a>, <a href="https://plugins.matomo.org/FormAnalytics">Form Analytics</a>, <a href="https://plugins.matomo.org/MediaAnalytics">Media Analytics</a>, <a href="https://plugins.matomo.org/MultiChannelConversionAttribution">Multi Channel Conversion Attribution</a>, and <a href="https://plugins.matomo.org/premium">more</a>. + + </p> + + <h2>How to upgrade</h2> + <p>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 <a href="https://matomo.org/support">get in touch</a> with us. At Matomo and at <a href="https://www.innocraft.com" onclick="javascript:window.open('https://www.innocraft.com/'); return false;">InnoCraft</a>, the company of the makers of Matomo, we have successfully updated many Matomo installations.</p> + <p> If your server meets the requirements for Matomo 3, you can <a href="https://matomo.org/docs/update/">upgrade your Piwik with our automatic updater</a>. + If not, you may need to upgrade your server before you can update to the latest server version. + </p> + + <h2>Don't want the hassle of updating and maintaining your Piwik? Migrate to the Matomo Analytics Cloud</h2> + <p> + We can migrate your Piwik database to our Matomo Analytics Cloud without the loss of any data while you keep 100% data ownership.<br /> + 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. + <br /><br /> + <a href="https://www.innocraft.cloud/">Learn more about the Matomo Analytics Cloud</a><br /> + <a href="https://www.innocraft.cloud/#pricing">View Pricing</a><br /> + <a href="https://www.innocraft.cloud/#contact">Get in touch with our support team to learn more about the migration</a><br /> + </p> + + {% if isSuperUser %} + <h2>Want to disable this warning? (not recommended)</h2> + <p> + A user with access to the server can edit the <code>config/config.ini.php</code> file and add the following lines (the line with <code>[General]</code> may already exist): + <br /> + <br /> + <pre><code>[General] +show_piwik2_end_of_life_warning = 0</code></pre> + </p> + {% endif %} + </div> + </div> +{% endblock %} diff --git a/tests/UI/specs/UIIntegration_spec.js b/tests/UI/specs/UIIntegration_spec.js index 97ea69678c..6d2a4cc0ac 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) { |