- Improved performance by skipping folders list sorting when it's not needed in folder manager

release-0.7
alecpl 13 years ago
parent 537c394302
commit 8881766a9f

@ -2918,11 +2918,12 @@ class rcube_imap
* @param string $name Optional name pattern * @param string $name Optional name pattern
* @param string $filter Optional filter * @param string $filter Optional filter
* @param string $rights Optional ACL requirements * @param string $rights Optional ACL requirements
* @param bool $skip_sort Enable to return unsorted list (for better performance)
* *
* @return array List of mailboxes/folders * @return array List of mailboxes/folders
* @access public * @access public
*/ */
function list_mailboxes($root='', $name='*', $filter=null, $rights=null) function list_mailboxes($root='', $name='*', $filter=null, $rights=null, $skip_sort=false)
{ {
$a_mboxes = $this->_list_mailboxes($root, $name, $filter, $rights); $a_mboxes = $this->_list_mailboxes($root, $name, $filter, $rights);
@ -2932,7 +2933,9 @@ class rcube_imap
} }
// sort mailboxes // sort mailboxes
if (!$skip_sort) {
$a_mboxes = $this->_sort_mailbox_list($a_mboxes); $a_mboxes = $this->_sort_mailbox_list($a_mboxes);
}
return $a_mboxes; return $a_mboxes;
} }
@ -3043,10 +3046,11 @@ class rcube_imap
* @param string $name Optional name pattern * @param string $name Optional name pattern
* @param mixed $filter Optional filter * @param mixed $filter Optional filter
* @param string $rights Optional ACL requirements * @param string $rights Optional ACL requirements
* @param bool $skip_sort Enable to return unsorted list (for better performance)
* *
* @return array Indexed array with folder names * @return array Indexed array with folder names
*/ */
function list_unsubscribed($root='', $name='*', $filter=null, $rights=null) function list_unsubscribed($root='', $name='*', $filter=null, $rights=null, $skip_sort=false)
{ {
// @TODO: caching // @TODO: caching
// Give plugins a chance to provide a list of mailboxes // Give plugins a chance to provide a list of mailboxes
@ -3076,7 +3080,9 @@ class rcube_imap
} }
// filter folders and sort them // filter folders and sort them
if (!$skip_sort) {
$a_mboxes = $this->_sort_mailbox_list($a_mboxes); $a_mboxes = $this->_sort_mailbox_list($a_mboxes);
}
return $a_mboxes; return $a_mboxes;
} }

@ -203,7 +203,7 @@ function rcube_subscription_form($attrib)
$IMAP->clear_cache('mailboxes', true); $IMAP->clear_cache('mailboxes', true);
$a_unsubscribed = $IMAP->list_unsubscribed(); $a_unsubscribed = $IMAP->list_unsubscribed();
$a_subscribed = $IMAP->list_mailboxes(); $a_subscribed = $IMAP->list_mailboxes('', '*', null, null, true); // unsorted
$delimiter = $IMAP->get_hierarchy_delimiter(); $delimiter = $IMAP->get_hierarchy_delimiter();
$namespace = $IMAP->get_namespace(); $namespace = $IMAP->get_namespace();
$a_js_folders = array(); $a_js_folders = array();

Loading…
Cancel
Save