backport of r53032: setting Horde_Imap_Client::STATUS_FORCE_REFRESH flag to force horde code to ignore cache in long running AS Ping command

This commit is contained in:
Klaus Leithoff 2015-07-03 08:00:35 +00:00
parent 6f2f6e71ed
commit aa5a72db84
2 changed files with 8 additions and 4 deletions

View File

@ -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;

View File

@ -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)
{