mirror of
https://github.com/retailcrm/Fetch.git
synced 2025-02-06 10:39:21 +03:00
logic update (should be the last)
This commit is contained in:
parent
6986ef830f
commit
743ceff0de
@ -323,16 +323,17 @@ class Server
|
||||
*/
|
||||
public function numMessages($mailbox='')
|
||||
{
|
||||
if ($mailbox===''){
|
||||
return imap_num_msg( $this->getImapStream() );
|
||||
}
|
||||
if (!$this->hasMailbox($mailbox) && $mailbox !== ''){
|
||||
return 0;
|
||||
}
|
||||
$oldMailbox = $this->getMailBox();
|
||||
$mboxExists = ($this->hasMailbox($mailbox) && $oldMailbox !== $mailbox && $mailbox !== '');
|
||||
if ($mboxExists){
|
||||
$this->setMailbox($mailbox);
|
||||
}
|
||||
$cnt = imap_num_msg($this->getImapStream());
|
||||
if ($mboxExists){
|
||||
$this->setMailbox($oldMailbox);
|
||||
}
|
||||
return ((!$mboxExists && $mailbox !== '') ? 0 : $cnt);
|
||||
return $cnt;
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
x
Reference in New Issue
Block a user