mirror of
https://github.com/retailcrm/Fetch.git
synced 2025-02-06 10:39:21 +03:00
more accurate check with support for zero
This commit is contained in:
parent
397b748370
commit
c40d2ce48c
@ -323,13 +323,16 @@ class Server
|
|||||||
*/
|
*/
|
||||||
public function numMessages( $mailbox='' )
|
public function numMessages( $mailbox='' )
|
||||||
{
|
{
|
||||||
$oldMailbox = $this->getMailBox();
|
$mboxExists = $this->hasMailbox( $mailbox );
|
||||||
if( $mailbox !== '' ) {
|
if( $mboxExists ) {
|
||||||
|
$oldMailbox = $this->getMailBox();
|
||||||
$this->setMailbox( $mailbox );
|
$this->setMailbox( $mailbox );
|
||||||
}
|
}
|
||||||
$cnt = imap_num_msg($this->getImapStream());
|
$cnt = imap_num_msg( $this->getImapStream() );
|
||||||
$this->setMailbox( $oldMailbox );
|
if( $mboxExists ) {
|
||||||
return $cnt;
|
$this->setMailbox( $oldMailbox );
|
||||||
|
}
|
||||||
|
return ( !$mboxExists && $mailbox !== '' ) ? 0 : $cnt;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
x
Reference in New Issue
Block a user