Fix queries to kolab_storage that include (obsolete) 'type'

This commit is contained in:
Thomas Bruederli 2013-10-07 19:20:45 +02:00
parent 6b89e36c4e
commit 6fb8c71095
3 changed files with 6 additions and 9 deletions

View file

@ -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,

View file

@ -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,

View file

@ -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]))