Skip to content

Commit

Permalink
Merge pull request #283 from matomo-org/develop
Browse files Browse the repository at this point in the history
Update master for 1.1.0 release
  • Loading branch information
tsteur authored May 20, 2020
2 parents 4121dfd + 7c16c25 commit 88abff5
Show file tree
Hide file tree
Showing 53 changed files with 1,143 additions and 503 deletions.
12 changes: 11 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,21 @@
== Changelog ==

= 1.1.0 =
* Support UTF8MB4 character set in tracking
* Improve compatibility with some plugins fixing some archiving issues
* Improve tracking settings for multi sites
* Add widgets to dashboard from the summary page
* Show a blog selector in the reporting page when using multi site
* Fix super admins weren't always synced in multisite mode
* By default delete all data on plugin uninstallation unless configured differently
* Improve system report
* Some minor fixes

= 1.0.6 =
* Improve compatibility with some other plugins
* Improve system report by adding more information
* Ensure to use WordPress DB charset


= 1.0.5 =
* Update Matomo core to 3.13.5
* Add location checks to system report
Expand Down
4 changes: 4 additions & 0 deletions app/core/CliMulti/RequestCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,10 @@ protected function execute(InputInterface $input, OutputInterface $output)
if (!empty($process)) {
$process->finishProcess();
}

while (ob_get_level()) {
echo ob_get_clean();
}
}

private function isTestModeEnabled()
Expand Down
2 changes: 1 addition & 1 deletion app/core/Db/Adapter.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ class Adapter
public static function factory($adapterName, & $dbInfos, $connect = true)
{
if ($connect) {
if ($dbInfos['port'][0] == '/') {
if (isset($dbInfos['port']) && is_string($dbInfos['port']) && $dbInfos['port'][0] == '/') {
$dbInfos['unix_socket'] = $dbInfos['port'];
unset($dbInfos['host']);
unset($dbInfos['port']);
Expand Down
2 changes: 1 addition & 1 deletion app/core/Theme.php
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ private function rewriteAssetPathIfOverridesFound($src)
foreach (Manager::getAlternativeWebRootDirectories() as $absDir => $webRootDirectory) {
$withoutPlugins = str_replace('plugins/', '', $pathAsset);
if (file_exists($absDir . '/' . $withoutPlugins)) {
return $webRootDirectory . $withoutPlugins;
return str_replace($pathAsset, $webRootDirectory . $withoutPlugins, $source);
}
}

Expand Down
5 changes: 4 additions & 1 deletion app/core/Tracker/Request.php
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,10 @@ public function __construct($params, $tokenAuth = false)

protected function replaceUnsupportedUtf8Chars($value, $key=false)
{
if (is_string($value) && preg_match('/[\x{10000}-\x{10FFFF}]/u', $value)) {
$dbConfig = Config::getInstance()->database;
if (!empty($dbConfig['charset'])
&& $dbConfig['charset'] !=='utf8mb4'
&& is_string($value) && preg_match('/[\x{10000}-\x{10FFFF}]/u', $value)) {
Common::printDebug("Unsupport character detected in $key. Replacing with \xEF\xBF\xBD");
return preg_replace('/[\x{10000}-\x{10FFFF}]/u', "\xEF\xBF\xBD", $value);
}
Expand Down
38 changes: 38 additions & 0 deletions app/core/Updates/3.13.6-b1.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
<?php
/**
* Piwik - free/libre analytics platform
*
* @link https://matomo.org
* @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
*
*/

namespace Piwik\Updates;

use Piwik\Updater;
use Piwik\Updates as PiwikUpdates;
use WpMatomo\Logger;

class Updates_3_13_6_b1 extends PiwikUpdates
{
public function doUpdate(Updater $updater)
{
global $wpdb;

if ($wpdb->charset === 'utf8mb4') {
$db_settings = new \WpMatomo\Db\Settings();
$installed_tables = $db_settings->get_installed_matomo_tables();
if (!empty($installed_tables)) {
foreach ($installed_tables as $installed_table) {
try {
$wpdb->query('ALTER TABLE `'.$installed_table.'` CONVERT TO CHARACTER SET utf8mb4');
} catch (\Exception $e) {
$logger = new Logger();
$logger->log("Failed to convert character set: " . $e->getMessage());
}
}
}
}
}

}
2 changes: 1 addition & 1 deletion app/core/Version.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ final class Version
* The current Matomo version.
* @var string
*/
const VERSION = '3.13.5';
const VERSION = '3.13.6-b1';

public function isStableVersion($version)
{
Expand Down
35 changes: 18 additions & 17 deletions app/js/piwik.min.js

Large diffs are not rendered by default.

35 changes: 18 additions & 17 deletions app/matomo.js

Large diffs are not rendered by default.

35 changes: 18 additions & 17 deletions app/piwik.js

Large diffs are not rendered by default.

5 changes: 5 additions & 0 deletions app/plugins/CoreAdminHome/Tasks.php
Original file line number Diff line number Diff line change
Expand Up @@ -277,6 +277,11 @@ public function purgeInvalidatedArchives()
if (empty($purgedDates[$yesterdayStr])) {
$this->archivePurger->purgeInvalidatedArchivesFrom($yesterday);
}
// handle year start table
$yearStart = $today->toString('Y-01');
if (empty($purgedDates[$yearStart])) {
$this->archivePurger->purgeInvalidatedArchivesFrom(Date::factory($yearStart . '-01'));
}
}

public function optimizeArchiveTable()
Expand Down
124 changes: 0 additions & 124 deletions app/plugins/GeoIp2/Commands/ConvertRegionCodesToIso.php

This file was deleted.

28 changes: 5 additions & 23 deletions assets/css/admin-style.css
Original file line number Diff line number Diff line change
Expand Up @@ -10,27 +10,6 @@
word-break: break-all;
}

.matomo-hero {
text-align: center;background: #3152a0;padding: 30px 20%;
}

.matomo-hero h2 {
color: white;font-size: 26px;line-height: 1.3;margin-top: 0;
}
.matomo-hero .matomo-cta-button {
background: #f77b00;color: white;padding: 8px 24px;
min-height: 28px;
height: auto;
}
.matomo-hero .matomo-next-link {
margin-left: 12px;
}
.matomo-hero a:not(.matomo-cta-button) {
color: white;
margin-top: 10px;
display: inline-block;
}

ul.matomo-list {
list-style-type: disc;
margin-left: 20px;
Expand All @@ -40,10 +19,13 @@ ol.matomo-list {
margin-left: 20px;
}

.plugin-card .matomo-description {
min-height: 57px;
.matomo-plugin-list .plugin-card-top {
min-height: auto;
}

.matomo-marketplace-notice .dashicons-video-alt3 {
display: inline-block;
}
.matomo-blockquote {
margin: .5em 10px;
border-left: 4px solid #ccc;
Expand Down
5 changes: 4 additions & 1 deletion classes/WpMatomo.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,12 @@
}

use WpMatomo\Admin\Menu;
use WpMatomo\Admin\Dashboard;
use WpMatomo\Commands\MatomoCommands;
use WpMatomo\Ecommerce\EasyDigitalDownloads;
use WpMatomo\Ecommerce\MemberPress;
use WpMatomo\OptOut;
use WpMatomo\Paths;
use WpMatomo\PrivacyBadge;
use WpMatomo\ScheduledTasks;
use \WpMatomo\Site\Sync as SiteSync;
use WpMatomo\AjaxTracker;
Expand Down Expand Up @@ -82,6 +82,9 @@ public function __construct() {
if ( is_admin() ) {
new Admin( self::$settings );

$dashboard = new Dashboard();
$dashboard->register_hooks();

$site_sync = new SiteSync( self::$settings );
$site_sync->register_hooks();
$user_sync = new UserSync();
Expand Down
2 changes: 1 addition & 1 deletion classes/WpMatomo/Admin/AdminSettings.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ public function show() {
$exclusions = new ExclusionSettings( $this->settings );
$geolocation = new GeolocationSettings( $this->settings );
$privacy = new PrivacySettings();
$advanced = new AdvancedSettings();
$advanced = new AdvancedSettings( $this->settings );
$setting_tabs = array(
self::TAB_TRACKING => $tracking,
self::TAB_ACCESS => $access_settings,
Expand Down
21 changes: 19 additions & 2 deletions classes/WpMatomo/Admin/AdvancedSettings.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@
use WpMatomo\Bootstrap;
use WpMatomo\Capabilities;
use WpMatomo\Settings;
use WpMatomo\Site;
use WpMatomo\TrackingCode\TrackingCodeGenerator;

if ( ! defined( 'ABSPATH' ) ) {
exit; // if accessed directly
Expand All @@ -37,6 +35,18 @@ class AdvancedSettings implements AdminSettingsInterface {
'HTTP_X_CLUSTER_CLIENT_IP',
);

/**
* @var Settings
*/
private $settings;

/**
* @param Settings $settings
*/
public function __construct( $settings ) {
$this->settings = $settings;
}

public function get_title() {
return esc_html__( 'Advanced', 'matomo' );
}
Expand All @@ -60,6 +70,12 @@ public function can_user_manage() {
}

private function apply_settings() {
if (!defined('MATOMO_REMOVE_ALL_DATA')) {
$this->settings->apply_changes(array(
Settings::DELETE_ALL_DATA_ON_UNINSTALL => !empty($_POST['matomo']['delete_all_data'])
));
}

Bootstrap::do_bootstrap();
$config = Config::getInstance();
$general = $config->General;
Expand Down Expand Up @@ -89,6 +105,7 @@ public function show_settings() {
}

$matomo_detected_ip = IP::getIpFromHeader();
$matomo_delete_all_data = $this->settings->should_delete_all_data_on_uninstall();

include dirname( __FILE__ ) . '/views/advanced_settings.php';
}
Expand Down
Loading

0 comments on commit 88abff5

Please sign in to comment.