Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/matomo-org/matomo.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/core
diff options
context:
space:
mode:
authordiosmosis <diosmosis@users.noreply.github.com>2020-12-24 02:42:15 +0300
committerGitHub <noreply@github.com>2020-12-24 02:42:15 +0300
commitddfa42e16f6648a1f54d2912fcc897e0ae07b75e (patch)
tree946ba5d504f97c941d691a6f9ce625df742c94f1 /core
parentc9ce54d30ef1abd915bf6c069d577e4052575bd3 (diff)
Better fix for climulti segment encoding bug (#17004)
* Segment should not be double encoded when async climulti is unsupported. * better fix for original bug, make sure request command sets query_string since it is used to get the segment * remove use * Use curl requests for core:archive in test. * fix test
Diffstat (limited to 'core')
-rw-r--r--core/CliMulti/Process.php16
-rw-r--r--core/CliMulti/RequestCommand.php2
-rw-r--r--core/CronArchive.php12
3 files changed, 27 insertions, 3 deletions
diff --git a/core/CliMulti/Process.php b/core/CliMulti/Process.php
index ad1d30cd56..8133da8878 100644
--- a/core/CliMulti/Process.php
+++ b/core/CliMulti/Process.php
@@ -8,6 +8,7 @@
namespace Piwik\CliMulti;
use Piwik\CliMulti;
+use Piwik\Container\StaticContainer;
use Piwik\Filesystem;
use Piwik\SettingsServer;
@@ -45,6 +46,15 @@ class Process
$this->markAsNotStarted();
}
+ private static function isForcingAsyncProcessMode()
+ {
+ try {
+ return (bool) StaticContainer::get('test.vars.forceCliMultiViaCurl');
+ } catch (\Exception $ex) {
+ return false;
+ }
+ }
+
public function getPid()
{
return $this->pid;
@@ -178,6 +188,12 @@ class Process
public static function isSupported()
{
+ if (defined('PIWIK_TEST_MODE')
+ && self::isForcingAsyncProcessMode()
+ ) {
+ return false;
+ }
+
if (SettingsServer::isWindows()) {
return false;
}
diff --git a/core/CliMulti/RequestCommand.php b/core/CliMulti/RequestCommand.php
index f2e07dcb94..8dbd8d9ed0 100644
--- a/core/CliMulti/RequestCommand.php
+++ b/core/CliMulti/RequestCommand.php
@@ -103,6 +103,8 @@ class RequestCommand extends ConsoleCommand
Url::setHost($hostname);
$query = $input->getArgument('url-query');
+ $_SERVER['QUERY_STRING'] = $query;
+
$query = UrlHelper::getArrayFromQueryString($query); // NOTE: this method can create the StaticContainer now
foreach ($query as $name => $value) {
$_GET[$name] = urldecode($value);
diff --git a/core/CronArchive.php b/core/CronArchive.php
index da8236b355..57e6ea259d 100644
--- a/core/CronArchive.php
+++ b/core/CronArchive.php
@@ -212,6 +212,11 @@ class CronArchive
private $cliMultiRequestParser;
/**
+ * @var bool|mixed
+ */
+ private $supportsAsync;
+
+ /**
* Constructor.
*
* @param string|null $processNewSegmentsFrom When to archive new segments from. See [General] process_new_segments_from
@@ -235,7 +240,8 @@ class CronArchive
$this->rawLogDao = new RawLogDao();
- $this->cliMultiRequestParser = new RequestParser($this->makeCliMulti()->supportsAsync());
+ $this->supportsAsync = $this->makeCliMulti()->supportsAsync();
+ $this->cliMultiRequestParser = new RequestParser($this->supportsAsync);
$this->archiveFilter = new ArchiveFilter();
}
@@ -654,7 +660,7 @@ class CronArchive
{
$request = "?module=API&method=CoreAdminHome.archiveReports&idSite=$idSite&period=$period&date=" . $date . "&format=json";
if ($segment) {
- $request .= '&segment=' . urlencode(urlencode($segment));
+ $request .= '&segment=' . urlencode($segment);
}
if (!empty($plugin)) {
$request .= "&plugin=" . $plugin;
@@ -696,7 +702,7 @@ class CronArchive
if (empty($response)) {
$message .= "The response was empty. This usually means a server error. A solution to this error is generally to increase the value of 'memory_limit' in your php.ini file. ";
- if($this->makeCliMulti()->supportsAsync()) {
+ if($this->supportsAsync) {
$message .= " For more information and the error message please check in your PHP CLI error log file. As this core:archive command triggers PHP processes over the CLI, you can find where PHP CLI logs are stored by running this command: php -i | grep error_log";
} else {
$message .= " For more information and the error message please check your web server's error Log file. As this core:archive command triggers PHP processes over HTTP, you can find the error message in your Matomo's web server error logs. ";