From aa5a72db844d9f65390f1e74f591604fdbf7470d Mon Sep 17 00:00:00 2001 From: Klaus Leithoff Date: Fri, 3 Jul 2015 08:00:35 +0000 Subject: [PATCH] backport of r53032: setting Horde_Imap_Client::STATUS_FORCE_REFRESH flag to force horde code to ignore cache in long running AS Ping command --- emailadmin/inc/class.emailadmin_imap.inc.php | 8 ++++++-- emailadmin/inc/class.emailadmin_imapbase.inc.php | 4 ++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/emailadmin/inc/class.emailadmin_imap.inc.php b/emailadmin/inc/class.emailadmin_imap.inc.php index 4b183fe9dd..1a63c71fdd 100644 --- a/emailadmin/inc/class.emailadmin_imap.inc.php +++ b/emailadmin/inc/class.emailadmin_imap.inc.php @@ -505,9 +505,10 @@ class emailadmin_imap extends Horde_Imap_Client_Socket implements defaultimap * getStatus * * @param string $mailbox + * @param ignoreStatusCache bool ignore the cache used for counters * @return array with counters */ - function getStatus($mailbox) + function getStatus($mailbox, $ignoreStatusCache=false) { $mailboxes = $this->listMailboxes($mailbox,Horde_Imap_Client::MBOX_ALL,array( 'attributes'=>true, @@ -516,6 +517,9 @@ class emailadmin_imap extends Horde_Imap_Client_Socket implements defaultimap 'special_use'=>true, )); + $flags = Horde_Imap_Client::STATUS_ALL; + if ($ignoreStatusCache) $flags |= Horde_Imap_Client::STATUS_FORCE_REFRESH; + $mboxes = new Horde_Imap_Client_Mailbox_List($mailboxes); //error_log(__METHOD__.__LINE__.array2string($mboxes->count())); foreach ($mboxes->getIterator() as $k =>$box) @@ -524,7 +528,7 @@ class emailadmin_imap extends Horde_Imap_Client_Socket implements defaultimap { if (stripos(array2string($box['attributes']),'\noselect')=== false) { - $status = $this->status($k); + $status = $this->status($k, $flags); foreach ($status as $key => $v) { $_status[strtoupper($key)]=$v; diff --git a/emailadmin/inc/class.emailadmin_imapbase.inc.php b/emailadmin/inc/class.emailadmin_imapbase.inc.php index 5e638e4ae1..4ba6a4b341 100644 --- a/emailadmin/inc/class.emailadmin_imapbase.inc.php +++ b/emailadmin/inc/class.emailadmin_imapbase.inc.php @@ -1083,7 +1083,7 @@ class emailadmin_imapbase } try { - $folderStatus[$this->icServer->ImapServerId][$folderName] = $this->icServer->getStatus($folderName); + $folderStatus[$this->icServer->ImapServerId][$folderName] = $this->icServer->getStatus($folderName,$ignoreStatusCache); } catch (Exception $e) { @@ -1151,7 +1151,7 @@ class emailadmin_imapbase if(!$folderInfo|| !is_array($folderInfo)) { try { - $folderInfo = $this->_getStatus($_folderName); + $folderInfo = $this->_getStatus($_folderName,$ignoreStatusCache); } catch (Exception $e) {