Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update live for upcoming 5.1.4 release #1199

Merged
merged 30 commits into from
Oct 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
2c02169
disable recommended private directories check
diosmosis Sep 10, 2024
c5bec2b
move youtube link to top of readme
diosmosis Sep 10, 2024
a19d6b9
Merge pull request #1196 from matomo-org/readme-tweaks
diosmosis Sep 10, 2024
75723e8
Merge pull request #1195 from matomo-org/1193-disable-private-dir-check
diosmosis Sep 11, 2024
9a4403e
update dependencies
diosmosis Sep 26, 2024
145ef49
tweak
diosmosis Sep 26, 2024
5a3eacd
update to 5.1.2
diosmosis Sep 26, 2024
0538e4c
fix release test
diosmosis Sep 26, 2024
0ffc752
update wordpress/woocommerce tested up to versions
diosmosis Sep 26, 2024
d24cd1e
update expected screenshots
diosmosis Sep 26, 2024
98e6354
separate marketplace e2e test screenshots by php version
diosmosis Sep 26, 2024
bbc2994
update expected screenshots
diosmosis Sep 26, 2024
19fb961
separate screenshots for mwp settings pages by php version as well as…
diosmosis Sep 26, 2024
9b82792
more separation of test screenshots by php version
diosmosis Sep 26, 2024
91904fb
updating more expected screenshots
diosmosis Sep 26, 2024
21f8fd7
workaround marketplace API bug
diosmosis Sep 26, 2024
a4e01a3
update marketplace submodule
diosmosis Sep 27, 2024
f609ff3
try to fix database collation warning in diagnostics page
diosmosis Sep 27, 2024
0dab2d6
add new screenshots required after adding php version differentiation
diosmosis Sep 27, 2024
bcd1d9e
add php version to one more screenshot file name
diosmosis Sep 27, 2024
44e0951
update expected screenshots
diosmosis Sep 27, 2024
df94229
update expected screenshots
diosmosis Sep 27, 2024
ce98326
increase timeouts
diosmosis Sep 28, 2024
cdaa68f
bump version to 5.1.4
diosmosis Sep 30, 2024
32dc1a6
add code to wp-config.php in local dev environment to allow use of ngrok
diosmosis Sep 30, 2024
5ea6783
use the column collation detected by the WordPress DB connection inst…
diosmosis Sep 30, 2024
7ea9c2f
Merge pull request #1197 from matomo-org/update-core-5.1.2
diosmosis Sep 30, 2024
de429b5
Merge branch 'develop' into new-release
diosmosis Sep 30, 2024
7108a8a
Merge pull request #1198 from matomo-org/new-release
diosmosis Sep 30, 2024
13df829
Merge branch 'live' into develop
diosmosis Sep 30, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
== Changelog ===

= 5.1.4 =
* Update Matomo core to version 5.1.2 (changes: https://matomo.org/changelog/matomo-5-1-2/)
* Update some Matomo core dependencies.

= 5.1.3 =
* Update Matomo core to version 5.1.1 (changes: https://matomo.org/changelog/matomo-5-1-1/)
* Moderate redesign to the feedback and get started admin pages.
Expand Down
91 changes: 84 additions & 7 deletions app/composer.lock

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

9 changes: 9 additions & 0 deletions app/config/global.ini.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,14 @@
; Matomo should work correctly without this setting but we recommend to have a charset set.
charset = utf8

; In some database setups the collation used for queries and creating tables can have unexpected
; values, or change after a database version upgrade.
; If you encounter "Illegal mix of collation" errors, setting this config to the value matching
; your existing database tables can help.
; This setting will only be used if "charset" is also set.
; Matomo should work correctly without this setting but we recommend to have a collation set.
collation =

; Database error codes to ignore during updates
;
;ignore_error_codes[] = 1105
Expand Down Expand Up @@ -84,6 +92,7 @@
type = InnoDB
schema = Mysql
charset = utf8mb4
collation = utf8mb4_general_ci
enable_ssl = 0
ssl_ca =
ssl_cert =
Expand Down
1 change: 1 addition & 0 deletions app/core/Db.php
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,7 @@ public static function createReaderDatabaseObject($dbConfig = null)
$dbConfig['type'] = $masterDbConfig['type'];
$dbConfig['tables_prefix'] = $masterDbConfig['tables_prefix'];
$dbConfig['charset'] = $masterDbConfig['charset'];
$dbConfig['collation'] = $masterDbConfig['collation'] ?? null;
$db = @Adapter::factory($dbConfig['adapter'], $dbConfig);
if (!empty($dbConfig['aurora_readonly_read_committed'])) {
$db->exec('set session aurora_read_replica_read_committed = ON;set session transaction isolation level read committed;');
Expand Down
19 changes: 19 additions & 0 deletions app/core/Db/Schema.php
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,25 @@ private function getSchema() : \Piwik\Db\SchemaInterface
}
return $this->schema;
}
/**
* Returns the default collation for a charset.
*
* @param string $charset
* @return string
*/
public function getDefaultCollationForCharset(string $charset) : string
{
return $this->getSchema()->getDefaultCollationForCharset($charset);
}
/**
* Get the table options to use for a CREATE TABLE statement.
*
* @return string
*/
public function getTableCreateOptions() : string
{
return $this->getSchema()->getTableCreateOptions();
}
/**
* Get the SQL to create a specific Piwik table
*
Expand Down
73 changes: 61 additions & 12 deletions app/core/Db/Schema/Mysql.php

Large diffs are not rendered by default.

27 changes: 27 additions & 0 deletions app/core/Db/Schema/Tidb.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,35 @@ public function supportsComplexColumnUpdates() : bool
{
return false;
}
public function getDefaultCollationForCharset(string $charset) : string
{
$collation = parent::getDefaultCollationForCharset($charset);
if ('utf8mb4' === $charset && 'utf8mb4_bin' === $collation) {
// replace the TiDB default "utf8mb4_bin" with a better default
return 'utf8mb4_0900_ai_ci';
}
return $collation;
}
public function getDefaultPort() : int
{
return 4000;
}
public function getTableCreateOptions() : string
{
$engine = $this->getTableEngine();
$charset = $this->getUsedCharset();
$collation = $this->getUsedCollation();
$rowFormat = $this->getTableRowFormat();
if ('utf8mb4' === $charset && '' === $collation) {
$collation = 'utf8mb4_0900_ai_ci';
}
$options = "ENGINE={$engine} DEFAULT CHARSET={$charset}";
if ('' !== $collation) {
$options .= " COLLATE={$collation}";
}
if ('' !== $rowFormat) {
$options .= " {$rowFormat}";
}
return $options;
}
}
14 changes: 14 additions & 0 deletions app/core/Db/SchemaInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -108,10 +108,24 @@ public function addMaxExecutionTimeHintToQuery(string $sql, float $limit) : stri
* @return bool
*/
public function supportsComplexColumnUpdates() : bool;
/**
* Returns the default collation for a charset used by this database engine.
*
* @param string $charset
*
* @return string
*/
public function getDefaultCollationForCharset(string $charset) : string;
/**
* Return the default port used by this database engine
*
* @return int
*/
public function getDefaultPort() : int;
/**
* Return the table options to use for a CREATE TABLE statement.
*
* @return string
*/
public function getTableCreateOptions() : string;
}
4 changes: 4 additions & 0 deletions app/core/Db/Settings.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,10 @@ public function getUsedCharset()
{
return strtolower($this->getDbSetting('charset'));
}
public function getUsedCollation()
{
return strtolower($this->getDbSetting('collation') ?? '');
}
public function getRowFormat()
{
return $this->getUsedCharset() === 'utf8mb4' ? 'ROW_FORMAT=DYNAMIC' : '';
Expand Down
14 changes: 13 additions & 1 deletion app/core/DbHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ public static function tableHasIndex($table, $indexName)
* @return string
* @throws Tracker\Db\DbException
*/
public static function getDefaultCharset()
public static function getDefaultCharset() : string
{
$result = \Piwik\Db::get()->fetchRow("SHOW CHARACTER SET LIKE 'utf8mb4'");
if (empty($result)) {
Expand All @@ -211,6 +211,18 @@ public static function getDefaultCharset()
}
return 'utf8mb4';
}
/**
* Returns the default collation for a charset.
*
* @param string $charset
*
* @return string
* @throws Exception
*/
public static function getDefaultCollationForCharset(string $charset) : string
{
return Schema::getInstance()->getDefaultCollationForCharset($charset);
}
/**
* Returns sql queries to convert all installed tables to utf8mb4
*
Expand Down
16 changes: 16 additions & 0 deletions app/core/Period/Range.php
Original file line number Diff line number Diff line change
Expand Up @@ -218,6 +218,10 @@ protected function generate()
$timezone = $this->timezone;
}
$endDate = Date::factory($strDateEnd, $timezone)->setTime("00:00:00");
$maxAllowedEndDate = Date::factory(self::getMaxAllowedEndTimestamp());
if ($endDate->isLater($maxAllowedEndDate)) {
$endDate = $maxAllowedEndDate;
}
} else {
throw new Exception($this->translator->translate('General_ExceptionInvalidDateRange', array($this->strDate, ' \'lastN\', \'previousN\', \'YYYY-MM-DD,YYYY-MM-DD\'')));
}
Expand Down Expand Up @@ -463,4 +467,16 @@ public function getParentPeriodLabel()
{
return null;
}
/**
* Returns the max allowed end timestamp for a range. If an enddate after this timestamp is provided, Matomo will
* automatically lower the end date to the date returned by this method.
* The max supported timestamp is always set to end of the current year plus 10 years.
*
* @return int
* @api
*/
public static function getMaxAllowedEndTimestamp() : int
{
return strtotime(date('Y-12-31 00:00:00', strtotime('+10 year', Date::getNowTimestamp())));
}
}
16 changes: 13 additions & 3 deletions app/core/Tracker/Db/Mysqli.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ class Mysqli extends Db
protected $username;
protected $password;
protected $charset;
protected $collation;
protected $activeTransaction = false;
protected $enable_ssl;
protected $ssl_key;
Expand Down Expand Up @@ -56,7 +57,8 @@ public function __construct($dbInfo, $driverName = 'mysql')
$this->dbname = $dbInfo['dbname'];
$this->username = $dbInfo['username'];
$this->password = $dbInfo['password'];
$this->charset = isset($dbInfo['charset']) ? $dbInfo['charset'] : null;
$this->charset = $dbInfo['charset'] ?? null;
$this->collation = $dbInfo['collation'] ?? null;
if (!empty($dbInfo['enable_ssl'])) {
$this->enable_ssl = $dbInfo['enable_ssl'];
}
Expand Down Expand Up @@ -119,8 +121,16 @@ public function connect()
if (!$this->connection || mysqli_connect_errno()) {
throw new \Piwik\Tracker\Db\DbException("Connect failed: " . mysqli_connect_error());
}
if ($this->charset && !mysqli_set_charset($this->connection, $this->charset)) {
throw new \Piwik\Tracker\Db\DbException("Set Charset failed: " . mysqli_error($this->connection));
if ($this->charset && $this->collation) {
// mysqli_set_charset does not support setting a collation
$query = "SET NAMES '" . $this->charset . "' COLLATE '" . $this->collation . "'";
if (!mysqli_query($this->connection, $query)) {
throw new \Piwik\Tracker\Db\DbException("Set charset/connection collation failed: " . mysqli_error($this->connection));
}
} elseif ($this->charset) {
if (!mysqli_set_charset($this->connection, $this->charset)) {
throw new \Piwik\Tracker\Db\DbException("Set Charset failed: " . mysqli_error($this->connection));
}
}
$this->password = '';
if (self::$profiling && isset($timer)) {
Expand Down
Loading
Loading