Changeset 2053 in subversion
- Timestamp:
- Nov 15, 2008 6:11:33 AM (5 years ago)
- Location:
- trunk/roundcubemail
- Files:
-
- 2 edited
-
CHANGELOG (modified) (1 diff)
-
program/include/rcube_imap.php (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/roundcubemail/CHANGELOG
r2049 r2053 1 1 CHANGELOG RoundCube Webmail 2 2 --------------------------- 3 4 2008/11/15 (alec) 5 ---------- 6 - Fix big memory consumption and speed up searching on servers without SORT capability 3 7 4 8 2008/11/12 (alec) -
trunk/roundcubemail/program/include/rcube_imap.php
r2052 r2053 593 593 $a_msg_headers = array(); 594 594 $deleted_count = $this->_fetch_headers($mailbox, $msgs, $a_msg_headers, $cache_key); 595 if ($this->sort_order == 'DESC' && $headers_sorted) { 596 //since the sort order is not used in the iil_c_sort function we have to do it here 597 $a_msg_headers = array_reverse($a_msg_headers); 598 } 595 599 596 // delete cached messages with a higher index than $max+1 600 597 // Changed $max to $max+1 to fix this bug : #1484295 601 598 $this->clear_message_cache($cache_key, $max + 1); 602 599 603 604 600 // kick child process to sync cache 605 601 // ... 606 607 602 } 608 603 … … 678 673 return array_values($a_msg_headers); 679 674 } 680 else { // SEARCH searching result 681 // not sorted, so we must fetch headers for all messages 682 // TODO: to minimize big memory consumption on servers without SORT 683 // capability, we should fetch only headers used for sorting, and then 684 // fetch all headers needed for displaying one page of messages list. 685 // Of course it has sense only for big results if count($msgs) > $this->pagesize 686 $this->_fetch_headers($mailbox, join(',', $msgs), $a_msg_headers, NULL); 687 688 // return empty array if no messages found 689 if (!is_array($a_msg_headers) || empty($a_msg_headers)) 690 return array(); 691 692 // if not already sorted 693 $a_msg_headers = iil_SortHeaders($a_msg_headers, $this->sort_field, $this->sort_order); 694 695 // only return the requested part of the set 696 return array_slice(array_values($a_msg_headers), $start_msg, min(count($msgs)-$start_msg, $this->page_size)); 675 else { // SEARCH searching result, need sorting 676 if ($cnt > $this->pagesize * 2) { 677 // use memory less expensive (and quick) method for big result set 678 $a_index = $this->message_index($mailbox, $this->sort_field, $this->sort_order); 679 // get messages uids for one page... 680 $msgs = array_slice(array_keys($a_index), $start_msg, min(count($msgs)-$start_msg, $this->page_size)); 681 // ...and fetch headers 682 $this->_fetch_headers($mailbox, join(',', $msgs), $a_msg_headers, NULL); 683 684 // return empty array if no messages found 685 if (!is_array($a_msg_headers) || empty($a_msg_headers)) 686 return array(); 687 688 $sorter = new rcube_header_sorter(); 689 $sorter->set_sequence_numbers($msgs); 690 $sorter->sort_headers($a_msg_headers); 691 692 return array_values($a_msg_headers); 693 } 694 else { 695 // for small result set we can fetch all messages headers 696 $this->_fetch_headers($mailbox, join(',', $msgs), $a_msg_headers, NULL); 697 698 // return empty array if no messages found 699 if (!is_array($a_msg_headers) || empty($a_msg_headers)) 700 return array(); 701 702 // if not already sorted 703 $a_msg_headers = iil_SortHeaders($a_msg_headers, $this->sort_field, $this->sort_order); 704 705 // only return the requested part of the set 706 return array_slice(array_values($a_msg_headers), $start_msg, min(count($msgs)-$start_msg, $this->page_size)); 707 } 697 708 } 698 709 } … … 814 825 else 815 826 { 816 // TODO: see list_header_set (fetch only one header field needed for sorting) 817 $this->_fetch_headers($mailbox, join(',', $this->search_set), $a_msg_headers, NULL); 818 819 foreach (iil_SortHeaders($a_msg_headers, $this->sort_field, $this->sort_order) as $i => $msg) 820 $this->cache[$key][] = $msg->id; 827 $a_index = iil_C_FetchHeaderIndex($this->conn, $mailbox, join(',', $this->search_set), $this->sort_field); 828 829 if ($this->sort_order=="ASC") 830 asort($a_index); 831 else if ($this->sort_order=="DESC") 832 arsort($a_index); 833 834 $this->cache[$key] = $a_index; 821 835 } 822 836 }
Note: See TracChangeset
for help on using the changeset viewer.
