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:
Diffstat (limited to 'core/SegmentExpression.php')
-rw-r--r--core/SegmentExpression.php12
1 files changed, 11 insertions, 1 deletions
diff --git a/core/SegmentExpression.php b/core/SegmentExpression.php
index 9340aec4bd..c6ddfddf4d 100644
--- a/core/SegmentExpression.php
+++ b/core/SegmentExpression.php
@@ -27,6 +27,9 @@ class Piwik_SegmentExpression
const MATCH_CONTAINS = '=@';
const MATCH_DOES_NOT_CONTAIN = '!@';
+ // Note: undocumented for now, only used in API.getSuggestedValuesForSegment
+ const MATCH_IS_NOT_NULL = '::';
+
// Special case, since we look up Page URLs/Page titles in a sub SQL query
const MATCH_ACTIONS_CONTAINS = 'IN';
@@ -66,6 +69,7 @@ class Piwik_SegmentExpression
. self::MATCH_LESS_OR_EQUAL . '|'
. self::MATCH_LESS . '|'
. self::MATCH_CONTAINS . '|'
+ . self::MATCH_IS_NOT_NULL . '|'
. self::MATCH_DOES_NOT_CONTAIN
. '){1}(.+)/';
$match = preg_match($pattern, $operand, $matches);
@@ -180,6 +184,11 @@ class Piwik_SegmentExpression
$value = '%' . $this->escapeLikeString($value) . '%';
break;
+ case self::MATCH_IS_NOT_NULL:
+ $sqlMatch = 'IS NOT NULL AND ('.$field.' <> \'\' OR '.$field.' = 0)';
+ $value = null;
+ break;
+
case self::MATCH_ACTIONS_CONTAINS:
// this match type is not accessible from the outside
// (it won't be matched in self::parseSubExpressions())
@@ -193,7 +202,8 @@ class Piwik_SegmentExpression
break;
}
- if ($matchType === self::MATCH_ACTIONS_CONTAINS) {
+ if ($matchType === self::MATCH_ACTIONS_CONTAINS
+ || is_null($value)) {
$sqlExpression = "$field $sqlMatch";
} else {
$sqlExpression = "$field $sqlMatch ?";