summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Bruederli <bruederli@kolabsys.com>2013-10-07 17:20:45 (GMT)
committerThomas Bruederli <bruederli@kolabsys.com>2013-10-07 17:20:45 (GMT)
commit6fb8c71095b0963f8396c995126dcfb02a86e25c (patch)
treeec771ac7f0d2a7d89d5060297cb70219500126ca
parent6b89e36c4e00c134efa6c552428936e1787beacd (diff)
downloadroundcubemail-plugins-kolab-6fb8c71095b0963f8396c995126dcfb02a86e25c.tar.gz
Fix queries to kolab_storage that include (obsolete) 'type'
-rw-r--r--plugins/libkolab/SQL/mysql.initial.sql1
-rw-r--r--plugins/libkolab/SQL/mysql/2013100400.sql1
-rw-r--r--plugins/libkolab/lib/kolab_storage_folder.php13
3 files changed, 6 insertions, 9 deletions
diff --git a/plugins/libkolab/SQL/mysql.initial.sql b/plugins/libkolab/SQL/mysql.initial.sql
index 97218b6..c6bcb89 100644
--- a/plugins/libkolab/SQL/mysql.initial.sql
+++ b/plugins/libkolab/SQL/mysql.initial.sql
@@ -126,7 +126,6 @@ CREATE TABLE `kolab_cache_file` (
`xml` TEXT NOT NULL,
`tags` VARCHAR(255) NOT NULL,
`words` TEXT NOT NULL,
- `type` VARCHAR(32) CHARACTER SET ascii NOT NULL,
`filename` varchar(255) DEFAULT NULL,
CONSTRAINT `fk_kolab_cache_file_folder` FOREIGN KEY (`folder_id`)
REFERENCES `kolab_folders`(`ID`) ON DELETE CASCADE ON UPDATE CASCADE,
diff --git a/plugins/libkolab/SQL/mysql/2013100400.sql b/plugins/libkolab/SQL/mysql/2013100400.sql
index aed3557..efd4962 100644
--- a/plugins/libkolab/SQL/mysql/2013100400.sql
+++ b/plugins/libkolab/SQL/mysql/2013100400.sql
@@ -101,7 +101,6 @@ CREATE TABLE `kolab_cache_file` (
`xml` TEXT NOT NULL,
`tags` VARCHAR(255) NOT NULL,
`words` TEXT NOT NULL,
- `type` VARCHAR(32) CHARACTER SET ascii NOT NULL,
`filename` varchar(255) DEFAULT NULL,
CONSTRAINT `fk_kolab_cache_file_folder` FOREIGN KEY (`folder_id`)
REFERENCES `kolab_folders`(`ID`) ON DELETE CASCADE ON UPDATE CASCADE,
diff --git a/plugins/libkolab/lib/kolab_storage_folder.php b/plugins/libkolab/lib/kolab_storage_folder.php
index ecb41d9..34d119e 100644
--- a/plugins/libkolab/lib/kolab_storage_folder.php
+++ b/plugins/libkolab/lib/kolab_storage_folder.php
@@ -431,17 +431,16 @@ class kolab_storage_folder
private function _prepare_query($query)
{
// string equals type query
+ // FIXME: should not be called this way!
if (is_string($query)) {
- if ($this->cache->has_type_col()) {
- $query = array(array('type','=',$query));
- }
- else {
- return array();
- }
+ return $this->cache->has_type_col() ? array(array('type','=',$query)) : array();
}
foreach ((array)$query as $i => $param) {
- if (($param[0] == 'dtstart' || $param[0] == 'dtend' || $param[0] == 'changed')) {
+ if ($param[0] == 'type' && !$this->cache->has_type_col()) {
+ unset($query[$i]);
+ }
+ else if (($param[0] == 'dtstart' || $param[0] == 'dtend' || $param[0] == 'changed')) {
if (is_object($param[2]) && is_a($param[2], 'DateTime'))
$param[2] = $param[2]->format('U');
if (is_numeric($param[2]))