Improve object fetching when cache is disabled
This commit is contained in:
parent
b37784bb3b
commit
0131c8aa51
2 changed files with 12 additions and 27 deletions
|
@ -301,7 +301,18 @@ class kolab_storage_cache
|
||||||
else {
|
else {
|
||||||
// extract object type from query parameter
|
// extract object type from query parameter
|
||||||
$filter = $this->_query2assoc($query);
|
$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
|
// TODO: post-filter result according to query
|
||||||
}
|
}
|
||||||
|
|
|
@ -288,32 +288,6 @@ class kolab_storage_folder
|
||||||
|
|
||||||
// fetch objects from cache
|
// fetch objects from cache
|
||||||
return $this->cache->select(array(array('type','=',$type)));
|
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;
|
|
||||||
*/
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue