Skip to content

Commit

Permalink
Update Matomo core to 3.12.0 (#58)
Browse files Browse the repository at this point in the history
  • Loading branch information
tsteur committed Nov 5, 2019
1 parent c888f26 commit 6f706ce
Show file tree
Hide file tree
Showing 1,700 changed files with 27,469 additions and 21,058 deletions.
10 changes: 6 additions & 4 deletions .travis.yml
Expand Up @@ -3,15 +3,17 @@ dist: trusty

language: php

install:
- cd ..
- ls
- mv wp-matomo matomo
- cd matomo

notifications:
email:
on_success: never
on_failure: change

branches:
only:
- master

cache:
directories:
- $HOME/.composer/cache
Expand Down
4 changes: 4 additions & 0 deletions CHANGELOG.md
@@ -1,3 +1,7 @@
0.2.0
- Update to Matomo 3.12.0
- Improve session start success check

0.1.9
- Better session error logging

Expand Down
7 changes: 7 additions & 0 deletions app/CHANGELOG.md
Expand Up @@ -4,6 +4,13 @@ This is the Developer Changelog for Matomo platform developers. All changes in o

The Product Changelog at **[matomo.org/changelog](https://matomo.org/changelog)** lets you see more details about any Matomo release, such as the list of new guides and FAQs, security fixes, and links to all closed issues.

## Matomo 3.12.0

### New API
* Added new event `Visualization.beforeRender`, triggered after immediately before rendering a visualization.
* Added new event `Http.sendHttpRequest` and `Http.sendHttpRequest.end` so plugins can listen to external HTTP requests, monitor them, or resolve the request themselves.
* Added new event `CliMulti.supportsAsync` so plugins can force or disable the usage of archiving through the CLI

## Matomo 3.10.0

### Breaking Changes
Expand Down
10 changes: 7 additions & 3 deletions app/LEGALNOTICE
Expand Up @@ -14,7 +14,7 @@ SOFTWARE LICENSE

The free software license of Matomo is GNU General Public License v3
or later. A copy of GNU GPL v3 should have been included in this
software package in misc/gpl-3.0.txt.
software package in LICENSE.


TRADEMARK
Expand All @@ -36,7 +36,7 @@ TRADEMARK
CREDITS

The software consists of contributions made by many individuals.
Major contributors are listed in https://matomo.org/the-piwik-team/.
Major contributors are listed in https://matomo.org/team/.

For detailed contribution history, refer to the source, tickets,
patches, and Git revision history, available at
Expand Down Expand Up @@ -217,6 +217,10 @@ THIRD-PARTY COMPONENTS AND LIBRARIES
Link: http://raphaeljs.com/
License: MIT (Expat)

Name: iFrame Resizer
Link: https://github.com/davidjbradshaw/iframe-resizer
License: MIT

Name: lessphp
Link: http://leafo.net/lessphp
License: GPL3, MIT (Expat)
Expand Down Expand Up @@ -275,7 +279,7 @@ THIRD-PARTY CONTENT
License: GPL
By: Alessandro Rei - http://www.kde-look.org/usermanager/search.php?username=mentalrey

Name: Material icons ("icon-info2", "icon-outline", "icon-settings", "icon-form", "icon-play", "icon-pause", "icon-replay", "icon-skip-next", "icon-skip-forward", "icon-stop", "icon-fast-forward", "icon-fast-rewind", "icon-bug", "icon-upload", "icon-segmented-visits-log") in plugins/Morpheus/fonts
Name: Material icons ("icon-info2", "icon-outline", "icon-settings", "icon-form", "icon-play", "icon-pause", "icon-replay", "icon-skip-next", "icon-skip-forward", "icon-stop", "icon-fast-forward", "icon-fast-rewind", "icon-bug", "icon-upload", "icon-segmented-visits-log") in plugins/Morpheus/fonts, and plugins/Morpheus/images/compare.svg
Link: https://design.google.com/icons/
License: Apache License Version 2.0

Expand Down
14 changes: 5 additions & 9 deletions app/README.md
@@ -1,8 +1,8 @@
# Matomo (formerly Piwik) - matomo.org

[![Latest Stable Version](https://poser.pugx.org/matomo-org/matomo/v/stable)](https://matomo.org/download/)
[![Latest Unstable Version](https://poser.pugx.org/matomo-org/matomo/v/unstable)](https://packagist.org/packages/piwik/piwik)
[![License](https://poser.pugx.org/matomo-org/matomo/license)](https://matomo.org/free-software/)
[![Latest Stable Version](https://poser.pugx.org/piwik/piwik/v/stable)](https://matomo.org/download/)
[![Latest Unstable Version](https://poser.pugx.org/piwik/piwik/v/unstable)](https://packagist.org/packages/piwik/piwik)
[![License](https://poser.pugx.org/piwik/piwik/license)](https://matomo.org/free-software/)

## Code Status

Expand All @@ -28,7 +28,7 @@ Or in short:
## License

Matomo is released under the GPL v3 (or later) license, see [misc/gpl-3.0.txt](misc/gpl-3.0.txt)
Matomo is released under the GPL v3 (or later) license, see [LICENSE](LICENSE)

## Requirements

Expand Down Expand Up @@ -107,7 +107,7 @@ What makes Matomo unique from the competition:
* Modern, easy to use User Interface: you can fully customize your dashboard, drag and drop widgets and more.

* Matomo features are built inside plugins: you can add new features and remove the ones you don’t need.
You can build your own web analytics plugins or hire a consultant to have your custom feature built-in Matomo
You can build your own web analytics plugins or hire a consultant to have your custom feature built-in Matomo.

* A vibrant international Open community of more than 200,000 active users (tracking even more websites!)

Expand All @@ -117,7 +117,3 @@ What makes Matomo unique from the competition:
Documentation and more info on https://matomo.org

We are together creating the best open analytics platform in the world!

## Known issues

* Untested is DB connection when configuring MYSQL SOCKETS OR PIPES as DB host, eg `define( 'DB_HOST', '127.0.0.1:/var/run/mysqld/mysqld.sock' );`
2 changes: 1 addition & 1 deletion matomo_bootstrap.php → app/bootstrap.php
Expand Up @@ -14,7 +14,7 @@

if ( ! defined( 'ABSPATH' ) ) {
// prevent from loading twice
require_once( dirname( __FILE__ ) . '/../../../wp-load.php' );
require_once( dirname( __FILE__ ) . '/../../../../wp-load.php' );
}

if ( ! defined( 'ABSPATH' ) ) {
Expand Down
35 changes: 33 additions & 2 deletions app/config/global.ini.php 100644 → 100755
Expand Up @@ -48,7 +48,6 @@
; If configured, the following queries will be executed on the reader instead of the writer.
; * archiving queries that hit a log table
; * live queries that hit a log table
; * fetching of archives when viewing a report
; You only want to enable a reader if you can ensure there is minimal replication lag / delay on the reader.
; Otherwise you might get corrupt data in the reports.
[database_reader]
Expand Down Expand Up @@ -209,6 +208,12 @@
enabled_periods_UI = "day,week,month,year,range"
enabled_periods_API = "day,week,month,year,range"

; whether to enable segment archiving cache
; Note: if you use any plugins, this need to be compliant with Matomo and
; * depending on the segment you create you may need a newer MySQL version (eg 5.7 or newer)
; * use a reader database for archiving in case you have configured a database reader
enable_segments_cache = 1

; whether to enable subquery cache for Custom Segment archiving queries
enable_segments_subquery_cache = 0
; Any segment subquery that matches more than segments_subquery_cache_limit IDs will not be cached,
Expand Down Expand Up @@ -357,6 +362,11 @@
; or make sure the date ranges users' want to see will be processed somehow.
archiving_range_force_on_browser_request = 1

; By default Matomo will automatically archive all date ranges any user has chosen in his account settings.
; This is limited to the available options last7, previous7, last30 and previous30.
; If you need any other period, or want to ensure one of those is always archived, you can define them here
archiving_custom_ranges[] =

; By default Matomo runs OPTIMIZE TABLE SQL queries to free spaces after deleting some data.
; If your Matomo tracks millions of pages, the OPTIMIZE TABLE queries might run for hours (seen in "SHOW FULL PROCESSLIST \g")
; so you can disable these special queries here:
Expand Down Expand Up @@ -538,6 +548,12 @@
; this limit can be adjusted by changing this value
live_visitor_profile_max_visits_to_aggregate = 100

; If configured, will abort a MySQL query after the configured amount of seconds and show an error in the UI to for
; example lower the date range or tweak the segment (if one is applied). Set it to -1 if the query time should not be
; limited. Note: This feature requires a recent MySQL version (5.7 or newer). Some MySQL forks like MariaDB might not
; support this feature which uses the MAX_EXECUTION_TIME hint.
live_query_max_execution_time = -1

; In "All Websites" dashboard, when looking at today's reports (or a date range including today),
; the page will automatically refresh every 5 minutes. Set to 0 to disable automatic refresh
multisites_refresh_after_seconds = 300
Expand Down Expand Up @@ -637,6 +653,9 @@
; With this option, you can disable the framed mode of the Overlay plugin. Use it if your website contains a framebuster.
overlay_disable_framed_mode = 0

; Controls whether the user is able to upload a custom logo for their Matomo install
enable_custom_logo = 1

; By default we check whether the Custom logo is writable or not, before we display the Custom logo file uploader
enable_custom_logo_check = 1

Expand All @@ -658,6 +677,12 @@
; - links to Uninstall themes will be disabled (but user can still enable/disable themes)
enable_plugins_admin = 1

; By setting this option to 0 the users management will be disabled
enable_users_admin = 1

; By setting this option to 0 the websites management will be disabled
enable_sites_admin = 1

; By setting this option to 1, it will be possible for Super Users to upload Matomo plugin ZIP archives directly in Matomo Administration.
; Enabling this opens a remote code execution vulnerability where
; an attacker who gained Super User access could execute custom PHP code in a Matomo plugin.
Expand Down Expand Up @@ -711,6 +736,12 @@
; The number of days to wait before sending the JavaScript tracking code email reminder.
num_days_before_tracking_code_reminder = 5

; The maximum number of segments that can be compared simultaneously.
data_comparison_segment_limit = 5

; The maximum number of periods that can be compared simultaneously.
data_comparison_period_limit = 5

; The path to a custom cacert.pem file Matomo should use.
; By default Matomo uses a file extracted from the Firefox browser and provided here: https://curl.haxx.se/docs/caextract.html.
; The file contains root CAs and is used to determine if the chain of a SSL certificate is valid and it is safe to connect.
Expand All @@ -722,7 +753,6 @@
; Default is 1.
enable_tracking_failures_notification = 1


[Tracker]

; Matomo uses "Privacy by default" model. When one of your users visit multiple of your websites tracked in this Matomo,
Expand Down Expand Up @@ -951,6 +981,7 @@
Plugins[] = RssWidget
Plugins[] = Feedback
Plugins[] = Monolog

Plugins[] = Login
Plugins[] = TwoFactorAuth
Plugins[] = UsersManager
Expand Down
3 changes: 3 additions & 0 deletions app/config/global.php
Expand Up @@ -9,6 +9,7 @@
return array(

'path.root' => PIWIK_DOCUMENT_ROOT,

'path.misc.user' => 'misc/user/',

'path.tmp' => function (ContainerInterface $c) {
Expand Down Expand Up @@ -117,6 +118,8 @@
'misc/package/WebAppGallery/*.xml',
'misc/package/WebAppGallery/install.sql',
'plugins/ImageGraph/fonts/unifont.ttf',
'plugins/*/config/tracker.php',
'plugins/*/config/config.php',
'vendor/autoload.php',
'vendor/composer/autoload_real.php',
'vendor/szymach/c-pchart/app/*',
Expand Down
6 changes: 1 addition & 5 deletions app/console 100644 → 100755
Expand Up @@ -4,13 +4,9 @@ if (!defined('PIWIK_DOCUMENT_ROOT')) {
define('PIWIK_DOCUMENT_ROOT', dirname(__FILE__) == '/' ? '' : dirname(__FILE__));
}

if (file_exists(PIWIK_DOCUMENT_ROOT . '/../matomo_bootstrap.php')) {
require_once PIWIK_DOCUMENT_ROOT . '/../matomo_bootstrap.php';
}

if (file_exists(PIWIK_DOCUMENT_ROOT . '/bootstrap.php')) {
require_once PIWIK_DOCUMENT_ROOT . '/bootstrap.php';
}
}

if (!defined('PIWIK_INCLUDE_PATH')) {
define('PIWIK_INCLUDE_PATH', PIWIK_DOCUMENT_ROOT);
Expand Down
11 changes: 10 additions & 1 deletion app/core/API/ApiRenderer.php
Expand Up @@ -14,6 +14,7 @@
use Piwik\DataTable;
use Piwik\Piwik;
use Piwik\Plugin;
use Piwik\SettingsServer;

/**
* API renderer
Expand All @@ -22,6 +23,8 @@ abstract class ApiRenderer
{
protected $request;

protected $hideIdSubDataTable;

final public function __construct($request)
{
$this->request = $request;
Expand All @@ -30,6 +33,12 @@ final public function __construct($request)

protected function init()
{
$this->hideIdSubDataTable = Common::getRequestVar('hideIdSubDatable', false, 'int', $this->request);
}

protected function shouldSendBacktrace()
{
return Common::isPhpCliMode() && SettingsServer::isArchivePhpTriggered();
}

abstract public function sendHeader();
Expand Down Expand Up @@ -101,7 +110,7 @@ protected function buildDataTableRenderer($dataTable)
$renderer->setTable($dataTable);
$renderer->setIdSite($idSite);
$renderer->setRenderSubTables(Common::getRequestVar('expanded', false, 'int', $this->request));
$renderer->setHideIdSubDatableFromResponse(Common::getRequestVar('hideIdSubDatable', false, 'int', $this->request));
$renderer->setHideIdSubDatableFromResponse($this->hideIdSubDataTable);

return $renderer;
}
Expand Down
1 change: 1 addition & 0 deletions app/core/API/DataTableManipulator.php
Expand Up @@ -192,6 +192,7 @@ protected function callApiAndReturnDataTable($apiModule, $method, $request)
$request['expanded'] = 0;
$request['format'] = 'original';
$request['format_metrics'] = 0;
$request['compare'] = 0;

// don't want to run recursive filters on the subtables as they are loaded,
// otherwise the result will be empty in places (or everywhere). instead we
Expand Down
9 changes: 7 additions & 2 deletions app/core/API/DataTableManipulator/Flattener.php
Expand Up @@ -102,8 +102,7 @@ protected function flattenDataTableInto($dataTable, $newDataTable, $level, $dime
* @param string $dimensionName
* @param bool $parentLogo
*/
private function flattenRow
(Row $row, $rowId, DataTable $dataTable, $level, $dimensionName,
private function flattenRow(Row $row, $rowId, DataTable $dataTable, $level, $dimensionName,
$labelPrefix = '', $parentLogo = false)
{
$dimensions = $dataTable->getMetadata('dimensions');
Expand Down Expand Up @@ -202,6 +201,12 @@ private function flattenRow
if ($origLabel !== false) {
foreach ($subTable->getRows() as $subRow) {
foreach ($row->getMetadata() as $name => $value) {
// do not set 'segment' parameter if there is a segmentValue on the row, since that will prevent the segmentValue
// from being used in DataTablePostProcessor
if ($name == 'segment' && $subRow->getMetadata('segmentValue') !== false) {
continue;
}

if ($subRow->getMetadata($name) === false) {
$subRow->setMetadata($name, $value);
}
Expand Down
38 changes: 36 additions & 2 deletions app/core/API/DataTableManipulator/LabelFilter.php
Expand Up @@ -28,6 +28,8 @@ class LabelFilter extends DataTableManipulator

private $labels;
private $addLabelIndex;
private $isComparing;
private $labelSeries;
const FLAG_IS_ROW_EVOLUTION = 'label_index';

/**
Expand All @@ -50,9 +52,18 @@ public function filter($labels, $dataTable, $addLabelIndex = false)
$labels = array($labels);
}

$this->labels = $labels;
$this->labels = array_values($labels);
$this->addLabelIndex = (bool)$addLabelIndex;
return $this->manipulate($dataTable);
$this->isComparing = $this->isComparing();

$labelSeries = Common::getRequestVar('labelSeries', '', 'string', $this->request);
$labelSeries = explode(',', $labelSeries);
$labelSeries = array_filter($labelSeries, 'strlen');
$this->labelSeries = $labelSeries;

$result = $this->manipulate($dataTable);

return $result;
}

/**
Expand Down Expand Up @@ -175,14 +186,37 @@ protected function manipulateDataTable($dataTable)

$row = $this->doFilterRecursiveDescend($labelVariation, $dataTable);
if ($row) {
if ($this->isComparing
&& isset($this->labelSeries[$labelIndex])
) {
$comparisons = $row->getComparisons();
if (!empty($comparisons)) {
$labelSeriesIndex = $this->labelSeries[$labelIndex];

$originalLabel = $row->getColumn('label');

$row = $comparisons->getRowFromId($labelSeriesIndex);

// add label and make sure it is the first column
$columns = array_merge(['label' => $originalLabel . ' ' . $row->getMetadata('compareSeriesPretty')], $row->getColumns());
$row->setColumns($columns);
}
}

if ($this->addLabelIndex) {
$row->setMetadata(self::FLAG_IS_ROW_EVOLUTION, $labelIndex);
}

$result->addRow($row);
break;
}
}
}
return $result;
}

private function isComparing()
{
return Common::getRequestVar('compare', 0, 'int', $this->request) == 1;
}
}

0 comments on commit 6f706ce

Please sign in to comment.