- 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.
release-0.6
alecpl 14 years ago
parent 29b39739df
commit 30b30226e6

@ -322,6 +322,26 @@ class rcube_imap
} }
/**
* Forces selection of a mailbox
*
* @param string $mailbox Mailbox/Folder name
* @access public
*/
function select_mailbox($mailbox)
{
$mailbox = $this->mod_mailbox($mailbox);
$selected = $this->conn->select($mailbox);
if ($selected && $this->mailbox != $mailbox) {
// clear messagecount cache for this mailbox
$this->_clear_messagecount($mailbox);
$this->mailbox = $mailbox;
}
}
/** /**
* Set internal list page * Set internal list page
* *

@ -20,7 +20,13 @@
*/ */
$uid = get_input_value('_uid', RCUBE_INPUT_GET); $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' if ($_SESSION['sort_col'] == 'date' && $_SESSION['sort_order'] != 'DESC'
&& empty($_REQUEST['_search']) && !$CONFIG['skip_deleted'] && !$IMAP->threading && empty($_REQUEST['_search']) && !$CONFIG['skip_deleted'] && !$IMAP->threading

Loading…
Cancel
Save