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
diff options
context:
space:
mode:
authordiosmosis <diosmosis@users.noreply.github.com>2018-11-24 06:18:29 +0300
committerGitHub <noreply@github.com>2018-11-24 06:18:29 +0300
commitbd0de0c5979de6091d7399f6ec70de0875c45048 (patch)
treef2fbe88c63de8cd0fe46bbc989e2656dd37ad643 /core/DataAccess
parentb136e24f399be080ed6ac7f7c060323fccba5081 (diff)
In LogAggregator, allow the use of a complex dimension w/ an already defined select as. (#13729)
* In LogAggregator, allow the use of a complex dimension w/ an already defined select as. * Add integration test for change.
Diffstat (limited to 'core/DataAccess')
-rw-r--r--core/DataAccess/LogAggregator.php13
1 files changed, 9 insertions, 4 deletions
diff --git a/core/DataAccess/LogAggregator.php b/core/DataAccess/LogAggregator.php
index ac87149c69..1801fa207e 100644
--- a/core/DataAccess/LogAggregator.php
+++ b/core/DataAccess/LogAggregator.php
@@ -423,6 +423,7 @@ class LogAggregator
* @param $dimensions
* @param $tableName
* @param bool $appendSelectAs
+ * @param bool $parseSelectAs
* @return mixed
*/
protected function getSelectDimensions($dimensions, $tableName, $appendSelectAs = true)
@@ -432,11 +433,15 @@ class LogAggregator
if (!is_numeric($selectAs)) {
$selectAsString = $selectAs;
- } else {
- // if function, do not alias or prefix
- if ($this->isFieldFunctionOrComplexExpression($field)) {
- $selectAsString = $appendSelectAs = false;
+ } else if ($this->isFieldFunctionOrComplexExpression($field)) {
+ // if complex expression has a select as, use it
+ if (!$appendSelectAs && preg_match('/\s+AS\s+(.*?)\s*$/', $field, $matches)) {
+ $field = $matches[1];
+ continue;
}
+
+ // if function w/o select as, do not alias or prefix
+ $selectAsString = $appendSelectAs = false;
}
$isKnownField = !in_array($field, array('referrer_data'));