summaryrefslogtreecommitdiff
path: root/program/include/rcube_imap_cache.php
diff options
context:
space:
mode:
authorAleksander Machniak <alec@alec.pl>2012-06-26 11:11:53 +0200
committerAleksander Machniak <alec@alec.pl>2012-06-26 11:11:53 +0200
commit7ab9c1775243217f3f6cb0717b1894a98303d04e (patch)
tree26dfb5b697344bcfa3bc97ba7e793bf26087ba7c /program/include/rcube_imap_cache.php
parentd86aa138d09c772f9506bf3c0ca2c65a8f33bdfa (diff)
Improve performance by skipping redundant ENABLE commands
Diffstat (limited to 'program/include/rcube_imap_cache.php')
-rw-r--r--program/include/rcube_imap_cache.php13
1 files changed, 6 insertions, 7 deletions
diff --git a/program/include/rcube_imap_cache.php b/program/include/rcube_imap_cache.php
index eb2df165f..fec651030 100644
--- a/program/include/rcube_imap_cache.php
+++ b/program/include/rcube_imap_cache.php
@@ -917,18 +917,17 @@ class rcube_imap_cache
return;
}
- // NOTE: make sure the mailbox isn't selected, before
- // enabling QRESYNC and invoking SELECT
- if ($this->imap->conn->selected !== null) {
- $this->imap->conn->close();
- }
-
// Enable QRESYNC
$res = $this->imap->conn->enable($qresync ? 'QRESYNC' : 'CONDSTORE');
- if (!is_array($res)) {
+ if ($res === false) {
return;
}
+ // Close mailbox if already selected to get most recent data
+ if ($this->imap->conn->selected == $mailbox) {
+ $this->imap->conn->close();
+ }
+
// Get mailbox data (UIDVALIDITY, HIGHESTMODSEQ, counters, etc.)
$mbox_data = $this->imap->folder_data($mailbox);