alecpl
2010-11-04 30b30226e6569f13e444cdcb513cd2bfc24318d7
- 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.


2 files modified
28 ■■■■■ changed files
program/include/rcube_imap.php 20 ●●●●● patch | view | raw | blame | history
program/steps/mail/pagenav.inc 8 ●●●● patch | view | raw | blame | history
program/include/rcube_imap.php
@@ -323,6 +323,26 @@
    
    /**
     * 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
     *
     * @param  number $page Page number to list
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