Branch 'dev/kolab3' - plugins/libkolab
Thomas Brüderli
bruederli at kolabsys.com
Wed May 9 19:12:37 CEST 2012
plugins/libkolab/lib/kolab_storage_cache.php | 13 ++++++++++++-
plugins/libkolab/lib/kolab_storage_folder.php | 26 --------------------------
2 files changed, 12 insertions(+), 27 deletions(-)
New commits:
commit 0131c8aa513cbea8ae78abca654c18ddd0499b70
Author: Thomas Bruederli <bruederli at kolabsys.com>
Date: Wed May 9 19:12:26 2012 +0200
Improve object fetching when cache is disabled
diff --git a/plugins/libkolab/lib/kolab_storage_cache.php b/plugins/libkolab/lib/kolab_storage_cache.php
index 65aa4cb..9f9431c 100644
--- a/plugins/libkolab/lib/kolab_storage_cache.php
+++ b/plugins/libkolab/lib/kolab_storage_cache.php
@@ -301,7 +301,18 @@ class kolab_storage_cache
else {
// extract object type from query parameter
$filter = $this->_query2assoc($query);
- $result = $this->_fetch($this->index, $filter['type']);
+
+ // use 'list' for folder's default objects
+ if ($filter['type'] == $this->type) {
+ $index = $this->index;
+ }
+ else { // search by object type
+ $search = 'UNDELETED HEADER X-Kolab-Type ' . kolab_storage_folder::KTYPE_PREFIX . $filter['type'];
+ $index = $this->imap->search_once($this->folder->name, $search)->get();
+ }
+
+ // fetch all messages in $index from IMAP
+ $result = $this->_fetch($index, $filter['type']);
// TODO: post-filter result according to query
}
diff --git a/plugins/libkolab/lib/kolab_storage_folder.php b/plugins/libkolab/lib/kolab_storage_folder.php
index eed7b08..d691906 100644
--- a/plugins/libkolab/lib/kolab_storage_folder.php
+++ b/plugins/libkolab/lib/kolab_storage_folder.php
@@ -288,32 +288,6 @@ class kolab_storage_folder
// fetch objects from cache
return $this->cache->select(array(array('type','=',$type)));
-
-/*
- $results = array();
- $ctype = self::KTYPE_PREFIX . $type;
-
- // use 'list' for folder's default objects
- if ($type == $this->type) {
- $index = $this->imap->index($this->name);
- }
- else { // search by object type
- $search = 'UNDELETED HEADER X-Kolab-Type ' . $ctype;
- $index = $this->imap->search_once($this->name, $search);
- }
-
- // fetch all messages from IMAP
- foreach ($index->get() as $msguid) {
- if ($object = $this->read_object($msguid, $type)) {
- $results[] = $object;
- $this->uid2msg[$object['uid']] = $msguid;
- }
- }
-
- // TODO: write $this->uid2msg to cache
-
- return $results;
-*/
}
More information about the commits
mailing list