summaryrefslogtreecommitdiff
path: root/program/include/rcube_imap_generic.php
diff options
context:
space:
mode:
authoralecpl <alec@alec.pl>2010-10-27 06:53:11 +0000
committeralecpl <alec@alec.pl>2010-10-27 06:53:11 +0000
commit36ed9d7ec69a0e774c13ed4c583b8674eee4fb98 (patch)
treefa7856fa07332d83a9693bef011dbf39963da9d6 /program/include/rcube_imap_generic.php
parentd21a05b48117ce7dbef4ad7997ed15c26bccf481 (diff)
- Improve performance of rcube_imap_generic::countMessages() using STATUS instead of SELECT
Diffstat (limited to 'program/include/rcube_imap_generic.php')
-rw-r--r--program/include/rcube_imap_generic.php7
1 files changed, 6 insertions, 1 deletions
diff --git a/program/include/rcube_imap_generic.php b/program/include/rcube_imap_generic.php
index 41240a2d1..2171e5d5d 100644
--- a/program/include/rcube_imap_generic.php
+++ b/program/include/rcube_imap_generic.php
@@ -944,11 +944,16 @@ class rcube_imap_generic
$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;
}