Improve object fetching when cache is disabled

This commit is contained in:
Thomas Bruederli 2012-05-09 19:12:26 +02:00
parent b37784bb3b
commit 0131c8aa51
2 changed files with 12 additions and 27 deletions

View file

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

View file

@ -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;
*/
}