Changeset 2673 in subversion
- Timestamp:
- Jun 22, 2009 2:32:51 PM (4 years ago)
- Location:
- trunk/roundcubemail/program/include
- Files:
-
- 2 edited
-
rcube_imap.php (modified) (9 diffs)
-
rcube_mdb2.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/roundcubemail/program/include/rcube_imap.php
r2672 r2673 864 864 865 865 // fetch complete message index 866 $msg_count = $this->_messagecount($mailbox);867 866 if ($this->get_capability('sort') && ($a_index = iil_C_Sort($this->conn, $mailbox, $this->sort_field, $this->skip_deleted ? 'UNDELETED' : ''))) 868 867 { … … 874 873 else 875 874 { 876 $a_index = iil_C_FetchHeaderIndex($this->conn, $mailbox, "1: $msg_count", $this->sort_field, $this->skip_deleted);875 $a_index = iil_C_FetchHeaderIndex($this->conn, $mailbox, "1:*", $this->sort_field, $this->skip_deleted); 877 876 878 877 if ($this->sort_order=="ASC") … … 920 919 if (isset($cache_index[$id])) 921 920 { 922 $this->remove_message_cache($cache_key, $cache_index[$id]);921 $for_remove[] = $cache_index[$id]; 923 922 unset($cache_index[$id]); 924 923 } 925 924 926 $toupdate[] = $id; 927 } 925 $for_update[] = $id; 926 } 927 928 // clear messages at wrong positions and those deleted that are still in cache_index 929 if (!empty($for_remove)) 930 $cache_index = array_merge($cache_index, $for_remove); 931 932 if (!empty($cache_index)) 933 $this->remove_message_cache($cache_key, $cache_index); 928 934 929 935 // fetch complete headers and add to cache 930 if (!empty($ toupdate)) {931 if ($headers = iil_C_FetchHeader($this->conn, $mailbox, join(',', $ toupdate), false, $this->fetch_add_headers))936 if (!empty($for_update)) { 937 if ($headers = iil_C_FetchHeader($this->conn, $mailbox, join(',', $for_update), false, $this->fetch_add_headers)) 932 938 foreach ($headers as $header) 933 939 $this->add_message_cache($cache_key, $header->id, $header); 934 }935 936 // those ids that are still in cache_index have been deleted937 if (!empty($cache_index))938 {939 foreach ($cache_index as $id => $uid)940 $this->remove_message_cache($cache_key, $uid);941 940 } 942 941 } … … 1550 1549 if ($this->caching_enabled) 1551 1550 { 1552 foreach ($uids as $uid) 1553 if ($cached_headers = $this->get_cached_message($cache_key, $uid)) 1554 $this->remove_message_cache($cache_key, $uid); 1551 $this->remove_message_cache($cache_key, $uids); 1555 1552 1556 1553 // close and re-open connection … … 1661 1658 1662 1659 // clear cache from the lowest index on 1663 $this->clear_message_cache($cache_key, $start_index); 1660 if ($start_index < 100000) 1661 $this->clear_message_cache($cache_key, $start_index); 1664 1662 } 1665 1663 … … 1716 1714 1717 1715 // clear cache from the lowest index on 1718 $this->clear_message_cache($cache_key, $start_index); 1716 if ($start_index < 100000) 1717 $this->clear_message_cache($cache_key, $start_index); 1719 1718 } 1720 1719 … … 2326 2325 $key, 2327 2326 $uid); 2328 2329 2327 if ($sql_arr = $this->db->fetch_assoc($sql_result)) 2330 2328 { … … 2433 2431 * @access private 2434 2432 */ 2435 function remove_message_cache($key, $uid )2433 function remove_message_cache($key, $uids) 2436 2434 { 2437 2435 if (!$this->caching_enabled) … … 2440 2438 $this->db->query( 2441 2439 "DELETE FROM ".get_table_name('messages')." 2442 WHERE user_id=?2443 AND cache_key=?2444 AND uid=?",2440 WHERE user_id=? 2441 AND cache_key=? 2442 AND uid IN (".$this->db->array2list($uids, 'integer').")", 2445 2443 $_SESSION['user_id'], 2446 $key, 2447 $uid); 2444 $key); 2448 2445 } 2449 2446 -
trunk/roundcubemail/program/include/rcube_mdb2.php
r2463 r2673 471 471 472 472 /** 473 * Return list of elements for use with SQL's IN clause 474 * 475 * @param string Input array 476 * @return string Elements list string 477 * @access public 478 */ 479 function array2list($arr, $type=null) 480 { 481 if (!is_array($arr)) 482 return $this->quote($arr, $type); 483 484 $res = array(); 485 foreach ($arr as $item) 486 $res[] = $this->quote($item, $type); 487 488 return implode(',', $res); 489 } 490 491 492 /** 473 493 * Return SQL statement to convert a field value into a unix timestamp 474 494 *
Note: See TracChangeset
for help on using the changeset viewer.
