diff options
| author | alec <alec@208e9e7b-5314-0410-a742-e7e81cd9613c> | 2008-11-15 15:30:19 +0000 |
|---|---|---|
| committer | alec <alec@208e9e7b-5314-0410-a742-e7e81cd9613c> | 2008-11-15 15:30:19 +0000 |
| commit | 474ce5d905b827e3c7966a203f4bd23f4b6f9ae5 (patch) | |
| tree | 904cf07b11437f29c2efca46108c52e5c7a8c54d | |
| parent | f4425436cdafa95bfada575809f6dd60d2df1a5b (diff) | |
- fix
git-svn-id: https://svn.roundcube.net/trunk@2056 208e9e7b-5314-0410-a742-e7e81cd9613c
| -rw-r--r-- | roundcubemail/program/include/rcube_imap.php | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/roundcubemail/program/include/rcube_imap.php b/roundcubemail/program/include/rcube_imap.php index 3fe651de6..5764a1f5d 100644 --- a/roundcubemail/program/include/rcube_imap.php +++ b/roundcubemail/program/include/rcube_imap.php @@ -673,11 +673,12 @@ class rcube_imap return array_values($a_msg_headers); } else { // SEARCH searching result, need sorting - if ($cnt > $this->pagesize * 2) { + $cnt = count($msgs); + if ($cnt > 300) { // experimantal best result // use memory less expensive (and quick) method for big result set $a_index = $this->message_index($mailbox, $this->sort_field, $this->sort_order); // get messages uids for one page... - $msgs = array_slice(array_keys($a_index), $start_msg, min(count($msgs)-$start_msg, $this->page_size)); + $msgs = array_slice(array_keys($a_index), $start_msg, min($cnt-$start_msg, $this->page_size)); // ...and fetch headers $this->_fetch_headers($mailbox, join(',', $msgs), $a_msg_headers, NULL); @@ -703,7 +704,7 @@ class rcube_imap $a_msg_headers = iil_SortHeaders($a_msg_headers, $this->sort_field, $this->sort_order); // only return the requested part of the set - return array_slice(array_values($a_msg_headers), $start_msg, min(count($msgs)-$start_msg, $this->page_size)); + return array_slice(array_values($a_msg_headers), $start_msg, min($cnt-$start_msg, $this->page_size)); } } } |
