plugins/libkolab
Aleksander Machniak
machniak at kolabsys.com
Mon Apr 22 15:54:18 CEST 2013
plugins/libkolab/lib/kolab_storage_cache.php | 12 +++++++++++-
1 file changed, 11 insertions(+), 1 deletion(-)
New commits:
commit 5f306222f203dc579af8a031dfaefd8b07222766
Author: Aleksander Machniak <machniak at kolabsys.com>
Date: Mon Apr 22 15:52:37 2013 +0200
Suppoprt more complicated cache queries, e.g. AND (tags LIKE ' tag1 ' OR tags LIKE ' tag2 ')
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';
}
More information about the commits
mailing list