From bf2c9be06640c1ce1fff6da893ddb55297069af9 Mon Sep 17 00:00:00 2001 From: Bjoern Schiessle Date: Fri, 28 Nov 2014 11:18:15 +0100 Subject: concatenate queries with 'or' --- lib/private/activitymanager.php | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) (limited to 'lib/private/activitymanager.php') diff --git a/lib/private/activitymanager.php b/lib/private/activitymanager.php index f31b121c8e8..e0ee7c1b055 100644 --- a/lib/private/activitymanager.php +++ b/lib/private/activitymanager.php @@ -247,16 +247,28 @@ class ActivityManager implements IManager { * @return array */ function getQueryForFilter($filter) { + + $conditions = array(); + $parameters = array(); + foreach($this->extensions as $extension) { $c = $extension(); if ($c instanceof IExtension) { $result = $c->getQueryForFilter($filter); if (is_array($result)) { - return $result; + list($condition, $parameter) = $result; + if ($condition && is_array($parameter)) { + $conditions[] = $condition; + $parameters = array_merge($parameters, $parameter); + } } } } - return array(null, null); + if (empty($conditions)) { + return array(null, null); + } + + return array(' and ((' . implode(') or (', $conditions) . '))', $parameters); } } -- cgit v1.2.3