- Improve performance of rcube_imap_generic::countMessages() using STATUS instead of SELECT

release-0.6
alecpl 14 years ago
parent d21a05b481
commit 36ed9d7ec6

@ -944,11 +944,16 @@ class rcube_imap_generic
$this->selected = ''; $this->selected = '';
} }
$this->select($mailbox);
if ($this->selected == $mailbox) { if ($this->selected == $mailbox) {
return $this->data['EXISTS']; 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; return false;
} }

@ -299,7 +299,7 @@ function rcube_subscription_form($attrib)
$table->add_row(array('id' => 'rcmrow'.$idx, 'class' => join(' ', $classes))); $table->add_row(array('id' => 'rcmrow'.$idx, 'class' => join(' ', $classes)));
$table->add('name', Q($display_folder)); $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 : ''), $table->add('subscribed', $checkbox_subscribe->show(($subscribed ? $folder_utf8 : ''),
array('value' => $folder_utf8, 'disabled' => ($protected || $noselect) ? 'disabled' : ''))); array('value' => $folder_utf8, 'disabled' => ($protected || $noselect) ? 'disabled' : '')));
if ($threading_supported) { if ($threading_supported) {

Loading…
Cancel
Save