summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAleksander Machniak <machniak@kolabsys.com>2013-04-22 13:52:37 (GMT)
committerAleksander Machniak <machniak@kolabsys.com>2013-04-22 13:52:37 (GMT)
commit5f306222f203dc579af8a031dfaefd8b07222766 (patch)
tree81127ddc26a2a2b8ab2118d6dcc4e138c917916a
parent4a0c47de0b16ce5f0abaac5e0a2349d1b7dd246b (diff)
downloadroundcubemail-plugins-kolab-5f306222f203dc579af8a031dfaefd8b07222766.tar.gz
Suppoprt more complicated cache queries, e.g. AND (tags LIKE ' tag1 ' OR tags LIKE ' tag2 ')
-rw-r--r--plugins/libkolab/lib/kolab_storage_cache.php12
1 files changed, 11 insertions, 1 deletions
diff --git a/plugins/libkolab/lib/kolab_storage_cache.php b/plugins/libkolab/lib/kolab_storage_cache.php
index ff8c276..9c80b28 100644
--- a/plugins/libkolab/lib/kolab_storage_cache.php
+++ b/plugins/libkolab/lib/kolab_storage_cache.php
@@ -417,7 +417,17 @@ class kolab_storage_cache
{
$sql_where = '';
foreach ($query as $param) {
- if ($param[1] == '=' && is_array($param[2])) {
+ if (is_array($param[0])) {
+ $subs = array();
+ foreach ($param[0] as $q) {
+ $subq[] = preg_replace('/^\s*AND\s+/i', '', $this->_sql_where(array($q)));
+ }
+ if (!empty($subq)) {
+ $sql_where .= ' AND (' . implode($param[1] == 'OR' ? ' OR ' : ' AND ', $subq) . ')';
+ }
+ continue;
+ }
+ else if ($param[1] == '=' && is_array($param[2])) {
$qvalue = '(' . join(',', array_map(array($this->db, 'quote'), $param[2])) . ')';
$param[1] = 'IN';
}