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='' )
|
||||
{
|
||||
$mboxExists = $this->hasMailbox( $mailbox );
|
||||
if( $mboxExists ) {
|
||||
$oldMailbox = $this->getMailBox();
|
||||
if( $mailbox !== '' ) {
|
||||
$this->setMailbox( $mailbox );
|
||||
}
|
||||
$cnt = imap_num_msg( $this->getImapStream() );
|
||||
if( $mboxExists ) {
|
||||
$this->setMailbox( $oldMailbox );
|
||||
return $cnt;
|
||||
}
|
||||
return ( !$mboxExists && $mailbox !== '' ) ? 0 : $cnt;
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
x
Reference in New Issue
Block a user