Skip to content

Commit

Permalink
Merge branch '3.x-dev' into fingers-crossed
Browse files Browse the repository at this point in the history
  • Loading branch information
diosmosis committed Feb 15, 2019
2 parents 6a68552 + 4fb1829 commit f95a0f7
Show file tree
Hide file tree
Showing 727 changed files with 9,072 additions and 4,245 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ php_errors.log
/robots.txt
/tmp/*
!/tmp/.gitkeep
!/tmp/CACHEDIR.TAG
/vendor/
/.cache
/.externalToolBuilders
Expand Down
33 changes: 31 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@
"twig/twig": "~1.0",
"leafo/lessphp": "~0.5.0",
"symfony/console": "~2.6.0",
"tedivm/jshrink": "~0.5.1",
"mustangostang/spyc": "~0.5.0",
"piwik/device-detector": "~3.0",
"piwik/decompress": "~1.0",
Expand All @@ -48,7 +47,8 @@
"composer/semver": "~1.3.0",
"szymach/c-pchart": "^2.0",
"geoip2/geoip2": "^2.8",
"davaxi/sparkline": "^1.1"
"davaxi/sparkline": "^1.1",
"matomo-org/jshrink": "1.3.1"
},
"require-dev": {
"aws/aws-sdk-php": "2.7.1",
Expand Down Expand Up @@ -84,6 +84,35 @@
"reference": "master"
}
}
},
{
"type": "package",
"package": {
"name": "matomo-org/jshrink",
"description": "Javascript Minifier built in PHP",
"keywords": ["minifier","javascript"],
"homepage": "http://github.com/tedious/JShrink",
"type": "library",
"license": "BSD-3-Clause",
"version": "1.3.1",
"authors": [
{
"name": "Robert Hafner",
"email": "[email protected]"
}
],
"require": {
"php": "*"
},
"autoload": {
"psr-0": {"JShrink": "src/"}
},
"source": {
"type": "git",
"url": "https://github.com/tedious/JShrink",
"reference": "v1.3.1"
}
}
}
],
"scripts": {
Expand Down
78 changes: 35 additions & 43 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions config/global.ini.php
Original file line number Diff line number Diff line change
Expand Up @@ -316,7 +316,7 @@
; Time in seconds after which an archive will be computed again. This setting is used only for today's statistics.
; This setting is overriden in the UI, under "General Settings".
; This setting is only used if it hasn't been overriden via the UI yet, or if enable_general_settings_admin=0
time_before_today_archive_considered_outdated = 150
time_before_today_archive_considered_outdated = 900

; Time in seconds after which an archive will be computed again. This setting is used only for week's statistics.
; If set to "-1" (default), it will fall back to the UI setting under "General settings" unless enable_general_settings_admin=0
Expand Down Expand Up @@ -377,7 +377,7 @@
; For legacy data, fallback or non-security scenarios, we use md5.
hash_algorithm = whirlpool

; Matomo uses PHP's dbtable for session. As of Matomo 3.8.0 it is the only supported handler.
; Matomo uses PHP's dbtable for session.
; If you prefer configuring sessions through the php.ini directly, you may unset this value to an empty string
session_save_handler = dbtable

Expand Down Expand Up @@ -693,7 +693,7 @@

; Matomo uses "Privacy by default" model. When one of your users visit multiple of your websites tracked in this Matomo,
; Matomo will create for this user a fingerprint that will be different across the multiple websites.
; If you want to track unique users across websites (for example when using the InterSites plugin) you may set this setting to 1.
; If you want to track unique users across websites you may set this setting to 1.
; Note: setting this to 0 increases your users' privacy.
enable_fingerprinting_across_websites = 0

Expand Down
35 changes: 35 additions & 0 deletions config/global.php
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@
'favicon.ico',
'robots.txt',
'.bowerrc',
'.lfsconfig',
'.phpstorm.meta.php',
'config/config.ini.php',
'config/config.php',
Expand Down Expand Up @@ -154,6 +155,40 @@

return $ipsResolved;
},
'Zend_Mail_Transport_Abstract' => function () {
$mailConfig = Config::getInstance()->mail;

if (empty($mailConfig['host'])
|| $mailConfig['transport'] != 'smtp'
) {
return;
}

$smtpConfig = array();
if (!empty($mailConfig['type'])) {
$smtpConfig['auth'] = strtolower($mailConfig['type']);
}

if (!empty($mailConfig['username'])) {
$smtpConfig['username'] = $mailConfig['username'];
}

if (!empty($mailConfig['password'])) {
$smtpConfig['password'] = $mailConfig['password'];
}

if (!empty($mailConfig['encryption'])) {
$smtpConfig['ssl'] = $mailConfig['encryption'];
}

if (!empty($mailConfig['port'])) {
$smtpConfig['port'] = $mailConfig['port'];
}

$host = trim($mailConfig['host']);
$transport = new \Zend_Mail_Transport_Smtp($host, $smtpConfig);
return $transport;
},

'Zend_Validate_EmailAddress' => function () {
return new \Zend_Validate_EmailAddress(array(
Expand Down
5 changes: 4 additions & 1 deletion core/API/DataTableGenericFilter.php
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,7 @@ protected function applyGenericFilters($datatable)
return;
}

$tableDisabledFilters = $datatable->getMetadata(DataTable::GENERIC_FILTERS_TO_DISABLE_METADATA_NAME) ?: [];
$genericFilters = $this->getGenericFiltersHavingDefaultValues();

$filterApplied = false;
Expand All @@ -164,7 +165,9 @@ protected function applyGenericFilters($datatable)
$filterParameters = array();
$exceptionRaised = false;

if (in_array($filterName, $this->disabledFilters)) {
if (in_array($filterName, $this->disabledFilters)
|| in_array($filterName, $tableDisabledFilters)
) {
continue;
}

Expand Down
3 changes: 2 additions & 1 deletion core/API/Proxy.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
use Piwik\Container\StaticContainer;
use Piwik\Context;
use Piwik\Piwik;
use Piwik\Plugin\Manager;
use Piwik\Singleton;
use ReflectionClass;
use ReflectionMethod;
Expand Down Expand Up @@ -441,7 +442,7 @@ private function getRequestParametersArray($requiredParameters, $parametersReque
private function includeApiFile($fileName)
{
$module = self::getModuleNameFromClassName($fileName);
$path = PIWIK_INCLUDE_PATH . '/plugins/' . $module . '/API.php';
$path = Manager::getPluginsDirectory() . $module . '/API.php';

if (is_readable($path)) {
require_once $path; // prefixed by PIWIK_INCLUDE_PATH
Expand Down
16 changes: 13 additions & 3 deletions core/Columns/MetricsList.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,15 @@ class MetricsList
*/
private $metrics = array();

private $metricsByNameCache = array();

/**
* @param Metric $metric
*/
public function addMetric(Metric $metric)
{
$this->metrics[] = $metric;
$this->metricsByNameCache = array();
}

/**
Expand All @@ -66,6 +69,7 @@ public function remove($metricCategory, $metricName = false)
if ($metric->getCategoryId() === $metricCategory) {
if (!$metricName || $metric->getName() === $metricName) {
unset($this->metrics[$index]);
$this->metricsByNameCache = array();
}
}
}
Expand All @@ -77,11 +81,17 @@ public function remove($metricCategory, $metricName = false)
*/
public function getMetric($metricName)
{
foreach ($this->metrics as $index => $metric) {
if ($metric->getName() === $metricName) {
return $metric;
if (empty($this->metricsByNameCache)) {
// this method might be called quite often... eg when having heaps of goals... need to cache it
foreach ($this->metrics as $index => $metric) {
$this->metricsByNameCache[$metric->getName()] = $metric;
}
}

if (!empty($this->metricsByNameCache[$metricName])) {
return $this->metricsByNameCache[$metricName];
}

return null;
}

Expand Down
3 changes: 2 additions & 1 deletion core/Columns/Updater.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
use Piwik\Plugin\Dimension\VisitDimension;
use Piwik\Plugin\Dimension\ConversionDimension;
use Piwik\Db;
use Piwik\Plugin\Manager;
use Piwik\Updater as PiwikUpdater;
use Piwik\Filesystem;
use Piwik\Cache as PiwikCache;
Expand Down Expand Up @@ -341,7 +342,7 @@ public function onNoUpdateAvailable($versionsThatWereChecked)

private static function getCurrentDimensionFileChanges()
{
$files = Filesystem::globr(PIWIK_INCLUDE_PATH . '/plugins/*/Columns', '*.php');
$files = Filesystem::globr(Manager::getPluginsDirectory() . '*/Columns', '*.php');

$times = array();
foreach ($files as $file) {
Expand Down
12 changes: 11 additions & 1 deletion core/Config.php
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,16 @@ public static function getCommonConfigPath()
return PIWIK_USER_PATH . self::DEFAULT_COMMON_CONFIG_PATH;
}

/**
* Returns default absolute path to the local configuration file.
*
* @return string
*/
public static function getDefaultLocalConfigPath()
{
return PIWIK_USER_PATH . self::DEFAULT_LOCAL_CONFIG_PATH;
}

/**
* Returns absolute path to the local configuration file
*
Expand All @@ -130,7 +140,7 @@ public static function getLocalConfigPath()
if ($path) {
return $path;
}
return PIWIK_USER_PATH . self::DEFAULT_LOCAL_CONFIG_PATH;
return self::getDefaultLocalConfigPath();
}

private static function getLocalConfigInfoForHostname($hostname)
Expand Down
Loading

0 comments on commit f95a0f7

Please sign in to comment.