alecpl
2010-10-27 36ed9d7ec69a0e774c13ed4c583b8674eee4fb98
- Improve performance of rcube_imap_generic::countMessages() using STATUS instead of SELECT


2 files modified
9 ■■■■ changed files
program/include/rcube_imap_generic.php 7 ●●●● patch | view | raw | blame | history
program/steps/settings/manage_folders.inc 2 ●●● patch | view | raw | blame | history
program/include/rcube_imap_generic.php
@@ -944,11 +944,16 @@
            $this->selected = '';
        }
        $this->select($mailbox);
        if ($this->selected == $mailbox) {
            return $this->data['EXISTS'];
        }
        // Try STATUS, should be faster
        $counts = $this->status($mailbox, array('MESSAGES'));
        if (is_array($counts)) {
            return (int) $counts['MESSAGES'];
        }
        return false;
    }
program/steps/settings/manage_folders.inc
@@ -299,7 +299,7 @@
    $table->add_row(array('id' => 'rcmrow'.$idx, 'class' => join(' ', $classes)));
    
    $table->add('name', Q($display_folder));
    $table->add('msgcount', ($folder['virtual'] ? '' : $IMAP->messagecount($folder['id'], 'ALL', false, false)));
    $table->add('msgcount', (($folder['virtual'] || $noselect) ? '' : $IMAP->messagecount($folder['id'], 'ALL', false, false)));
    $table->add('subscribed', $checkbox_subscribe->show(($subscribed ? $folder_utf8 : ''),
      array('value' => $folder_utf8, 'disabled' => ($protected || $noselect) ? 'disabled' : '')));
    if ($threading_supported) {