Branch 'roundcubemail-plugins-kolab-3.1' - plugins/libkolab
Thomas Brüderli
bruederli at kolabsys.com
Mon Jan 6 17:09:03 CET 2014
plugins/libkolab/lib/kolab_storage_cache.php | 14 ++++++--------
1 file changed, 6 insertions(+), 8 deletions(-)
New commits:
commit 1b2b0d52537f1ab8a6944c4a2da357e8a0a93d4a
Author: Thomas Bruederli <bruederli at kolabsys.com>
Date: Mon Jan 6 17:08:02 2014 +0100
Avoid fatal errors if folder type information is missing (#1321)
diff --git a/plugins/libkolab/lib/kolab_storage_cache.php b/plugins/libkolab/lib/kolab_storage_cache.php
index db174e5..98f32a8 100644
--- a/plugins/libkolab/lib/kolab_storage_cache.php
+++ b/plugins/libkolab/lib/kolab_storage_cache.php
@@ -29,7 +29,7 @@ class kolab_storage_cache
protected $folder;
protected $uid2msg;
protected $objects;
- protected $index = array();
+ protected $index = null;
protected $metadata = array();
protected $folder_id;
protected $resource_uri;
@@ -58,8 +58,10 @@ class kolab_storage_cache
rcube::raise_error(array(
'code' => 900,
'type' => 'php',
- 'message' => "No kolab_storage_cache class found for folder of type " . $storage_folder->type
+ 'message' => "No kolab_storage_cache class found for folder '$storage_folder->name' of type '$storage_folder->type'"
), true);
+
+ return new kolab_storage_cache($storage_folder);
}
}
@@ -104,7 +106,7 @@ class kolab_storage_cache
$this->resource_uri = $this->folder->get_resource_uri();
$this->folders_table = $this->db->table_name('kolab_folders');
$this->cache_table = $this->db->table_name('kolab_cache_' . $this->folder->type);
- $this->ready = $this->enabled;
+ $this->ready = $this->enabled && !empty($this->folder->type);
$this->folder_id = null;
}
@@ -438,7 +440,7 @@ class kolab_storage_cache
$filter = $this->_query2assoc($query);
// use 'list' for folder's default objects
- if ($filter['type'] == $this->type) {
+ if (is_array($this->index) && $filter['type'] == $this->type) {
$index = $this->index;
}
else { // search by object type
@@ -446,10 +448,6 @@ class kolab_storage_cache
$index = $this->imap->search_once($this->folder->name, $search)->get();
}
- if ($index->is_error()) {
- return null;
- }
-
// fetch all messages in $index from IMAP
$result = $uids ? $this->_fetch_uids($index, $filter['type']) : $this->_fetch($index, $filter['type']);
More information about the commits
mailing list