diff options
author | alecpl <alec@alec.pl> | 2011-10-05 11:35:19 +0000 |
---|---|---|
committer | alecpl <alec@alec.pl> | 2011-10-05 11:35:19 +0000 |
commit | 8881766a9fc626585c9d00a139ff3dd5621745dd (patch) | |
tree | 514d500ecb1bbd33067862dec90bb7e8c9eed4bd | |
parent | 537c394302df13e7623a36b28b11caceeaaa75b2 (diff) |
- Improved performance by skipping folders list sorting when it's not needed in folder manager
-rw-r--r-- | program/include/rcube_imap.php | 30 | ||||
-rw-r--r-- | program/steps/settings/folders.inc | 2 |
2 files changed, 19 insertions, 13 deletions
diff --git a/program/include/rcube_imap.php b/program/include/rcube_imap.php index 5eee8d6d3..859c08936 100644 --- a/program/include/rcube_imap.php +++ b/program/include/rcube_imap.php @@ -2914,15 +2914,16 @@ class rcube_imap /** * Public method for listing subscribed folders * - * @param string $root Optional root folder - * @param string $name Optional name pattern - * @param string $filter Optional filter - * @param string $rights Optional ACL requirements + * @param string $root Optional root folder + * @param string $name Optional name pattern + * @param string $filter Optional filter + * @param string $rights Optional ACL requirements + * @param bool $skip_sort Enable to return unsorted list (for better performance) * * @return array List of mailboxes/folders * @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); @@ -2932,7 +2933,9 @@ class rcube_imap } // sort mailboxes - $a_mboxes = $this->_sort_mailbox_list($a_mboxes); + if (!$skip_sort) { + $a_mboxes = $this->_sort_mailbox_list($a_mboxes); + } return $a_mboxes; } @@ -3039,14 +3042,15 @@ class rcube_imap /** * Get a list of all folders available on the IMAP server * - * @param string $root IMAP root dir - * @param string $name Optional name pattern - * @param mixed $filter Optional filter - * @param string $rights Optional ACL requirements + * @param string $root IMAP root dir + * @param string $name Optional name pattern + * @param mixed $filter Optional filter + * @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 */ - function list_unsubscribed($root='', $name='*', $filter=null, $rights=null) + function list_unsubscribed($root='', $name='*', $filter=null, $rights=null, $skip_sort=false) { // @TODO: caching // Give plugins a chance to provide a list of mailboxes @@ -3076,7 +3080,9 @@ class rcube_imap } // filter folders and sort them - $a_mboxes = $this->_sort_mailbox_list($a_mboxes); + if (!$skip_sort) { + $a_mboxes = $this->_sort_mailbox_list($a_mboxes); + } return $a_mboxes; } diff --git a/program/steps/settings/folders.inc b/program/steps/settings/folders.inc index 1d5df46e9..206f62c60 100644 --- a/program/steps/settings/folders.inc +++ b/program/steps/settings/folders.inc @@ -203,7 +203,7 @@ function rcube_subscription_form($attrib) $IMAP->clear_cache('mailboxes', true); $a_unsubscribed = $IMAP->list_unsubscribed(); - $a_subscribed = $IMAP->list_mailboxes(); + $a_subscribed = $IMAP->list_mailboxes('', '*', null, null, true); // unsorted $delimiter = $IMAP->get_hierarchy_delimiter(); $namespace = $IMAP->get_namespace(); $a_js_folders = array(); |