Skip to content

Commit

Permalink
Mention Piwik 2 is no longer supported (Piwik 2.18) (#13448)
Browse files Browse the repository at this point in the history
* Mention Piwik 2 is no longer supported

* add image

* Update ControllerAdmin.php

* Update Controller.php

* do  not show it for anonymous
  • Loading branch information
tsteur authored Dec 6, 2018
1 parent 3b16730 commit 5596f77
Show file tree
Hide file tree
Showing 7 changed files with 124 additions and 0 deletions.
2 changes: 2 additions & 0 deletions config/global.ini.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 2 additions & 0 deletions core/Plugin/Controller.php
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
46 changes: 46 additions & 0 deletions core/Plugin/ControllerAdmin.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
*/
namespace Piwik\Plugin;

use Piwik\Common;
use Piwik\Config as PiwikConfig;
use Piwik\Config;
use Piwik\Container\StaticContainer;
Expand All @@ -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;
Expand Down Expand Up @@ -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.<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()) {
Expand Down Expand Up @@ -322,13 +365,16 @@ public static function setBasicVariablesAdminView(View $view)

$view->isSuperUser = Piwik::hasUserSuperUserAccess();

self::notifyPiwik2EndOfLife();
self::notifyAnyInvalidLicense();
self::notifyAnyInvalidPlugin();
self::notifyWhenPhpVersionIsEOL();
self::notifyWhenPhpVersionIsNotCompatibleWithNextMajorPiwik();
self::notifyWhenDebugOnDemandIsEnabled('debug');
self::notifyWhenDebugOnDemandIsEnabled('debug_on_demand');



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

Expand Down
8 changes: 8 additions & 0 deletions plugins/CoreHome/Controller.php
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
Binary file added plugins/CoreHome/images/piwik3.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
60 changes: 60 additions & 0 deletions plugins/CoreHome/templates/piwikIsOutdated.twig
Original file line number Diff line number Diff line change
@@ -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 %}
6 changes: 6 additions & 0 deletions tests/UI/specs/UIIntegration_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit 5596f77

Please sign in to comment.