summaryrefslogtreecommitdiff
path: root/program/steps/mail/pagenav.inc
diff options
context:
space:
mode:
authoralecpl <alec@alec.pl>2010-11-04 14:03:26 +0000
committeralecpl <alec@alec.pl>2010-11-04 14:03:26 +0000
commit30b30226e6569f13e444cdcb513cd2bfc24318d7 (patch)
tree7944cd0e39dd36c880c6fe684c42779d89ad7d6c /program/steps/mail/pagenav.inc
parent29b39739df3393f138dbdd98591e1331af0393ad (diff)
- Add possibility to force mailbox selection. There're situations where we're invoking
STATUS (for all messages count) and SELECT later for other operations. If we call SELECT first, the STATUS will be not needed.
Diffstat (limited to 'program/steps/mail/pagenav.inc')
-rw-r--r--program/steps/mail/pagenav.inc8
1 files changed, 7 insertions, 1 deletions
diff --git a/program/steps/mail/pagenav.inc b/program/steps/mail/pagenav.inc
index b62520fab..e295114e1 100644
--- a/program/steps/mail/pagenav.inc
+++ b/program/steps/mail/pagenav.inc
@@ -20,7 +20,13 @@
*/
$uid = get_input_value('_uid', RCUBE_INPUT_GET);
-$cnt = $IMAP->messagecount(NULL, 'ALL'); // Only messages, no threads here
+
+// Select mailbox first, for better performance
+$mbox_name = $IMAP->get_mailbox_name();
+$IMAP->select_mailbox($mbox_name);
+
+// Get messages count (only messages, no threads here)
+$cnt = $IMAP->messagecount(NULL, 'ALL');
if ($_SESSION['sort_col'] == 'date' && $_SESSION['sort_order'] != 'DESC'
&& empty($_REQUEST['_search']) && !$CONFIG['skip_deleted'] && !$IMAP->threading