Changeset 5316 in subversion
- Timestamp:
- Oct 6, 2011 11:49:33 AM (20 months ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/roundcubemail/program/include/rcube_imap.php
r5309 r5316 2921 2921 * @param bool $skip_sort Enable to return unsorted list (for better performance) 2922 2922 * 2923 * @return array List of mailboxes/folders2923 * @return array List of folders 2924 2924 * @access public 2925 2925 */ 2926 2926 function list_mailboxes($root='', $name='*', $filter=null, $rights=null, $skip_sort=false) 2927 2927 { 2928 $cache_key = $root.':'.$name; 2929 if (!empty($filter)) { 2930 $cache_key .= ':'.(is_string($filter) ? $filter : serialize($filter)); 2931 } 2932 $cache_key .= ':'.$rights; 2933 $cache_key = 'mailboxes.'.md5($cache_key); 2934 2935 // get cached folder list 2936 $a_mboxes = $this->get_cache($cache_key); 2937 if (is_array($a_mboxes)) { 2938 return $a_mboxes; 2939 } 2940 2928 2941 $a_mboxes = $this->_list_mailboxes($root, $name, $filter, $rights); 2942 2943 if (!is_array($a_mboxes)) { 2944 return array(); 2945 } 2946 2947 // filter folders list according to rights requirements 2948 if ($rights && $this->get_capability('ACL')) { 2949 $a_mboxes = $this->filter_rights($a_mboxes, $rights); 2950 } 2929 2951 2930 2952 // INBOX should always be available … … 2933 2955 } 2934 2956 2935 // sort mailboxes 2936 if (!$skip_sort ) {2957 // sort mailboxes (always sort for cache) 2958 if (!$skip_sort || $this->cache) { 2937 2959 $a_mboxes = $this->_sort_mailbox_list($a_mboxes); 2938 2960 } 2961 2962 // write mailboxlist to cache 2963 $this->update_cache($cache_key, $a_mboxes); 2939 2964 2940 2965 return $a_mboxes; … … 2956 2981 private function _list_mailboxes($root='', $name='*', $filter=null, $rights=null) 2957 2982 { 2958 $cache_key = $root.':'.$name;2959 if (!empty($filter)) {2960 $cache_key .= ':'.(is_string($filter) ? $filter : serialize($filter));2961 }2962 $cache_key .= ':'.$rights;2963 2964 $cache_key = 'mailboxes.'.md5($cache_key);2965 2966 // get cached folder list2967 $a_mboxes = $this->get_cache($cache_key);2968 if (is_array($a_mboxes)) {2969 return $a_mboxes;2970 }2971 2972 2983 $a_defaults = $a_out = array(); 2973 2984 … … 2980 2991 } 2981 2992 else if (!$this->conn->connected()) { 2982 return array();2993 return null; 2983 2994 } 2984 2995 else { … … 3027 3038 $a_folders = array(); 3028 3039 } 3029 3030 // filter folders list according to rights requirements3031 if ($rights && $this->get_capability('ACL')) {3032 $a_folders = $this->filter_rights($a_folders, $rights);3033 }3034 3035 // write mailboxlist to cache3036 $this->update_cache($cache_key, $a_folders);3037 3040 3038 3041 return $a_folders;
Note: See TracChangeset
for help on using the changeset viewer.
