summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoralecpl <alec@alec.pl>2010-10-29 10:27:22 +0000
committeralecpl <alec@alec.pl>2010-10-29 10:27:22 +0000
commit01bdfd327c13faecb60ad7aa328557c3f5db3a9b (patch)
tree91b3d0401cdd14dff78ec0c0b09fb1fa90603b1b
parent2cd443315dbd0b3d7fdec78f0042f22d20e57ede (diff)
- Improve performance of clear_mailbox() when skip_deleted=true
-rw-r--r--program/include/rcube_imap.php8
1 files changed, 3 insertions, 5 deletions
diff --git a/program/include/rcube_imap.php b/program/include/rcube_imap.php
index a4b18c970..ae53741eb 100644
--- a/program/include/rcube_imap.php
+++ b/program/include/rcube_imap.php
@@ -2620,14 +2620,12 @@ class rcube_imap
function clear_mailbox($mbox_name=NULL)
{
$mailbox = !empty($mbox_name) ? $this->mod_mailbox($mbox_name) : $this->mailbox;
- $msg_count = $this->_messagecount($mailbox, 'ALL');
- if (!$msg_count) {
- return 0;
+ // SELECT will set messages count for clearFolder()
+ if ($this->conn->select($mailbox)) {
+ $cleared = $this->conn->clearFolder($mailbox);
}
- $cleared = $this->conn->clearFolder($mailbox);
-
// make sure the message count cache is cleared as well
if ($cleared) {
$this->clear_message_cache($mailbox.'.msg');