/** * @param Folder $folder * @return bool */ function PurgeFolder(&$folder) { $result = true; //$fs = new FileSystem(INI_DIR.'/temp', $this->_account->Email, $this->_account->Id); if ($this->_account->MailProtocol == MAILPROTOCOL_POP3 || $this->_account->MailProtocol == MAILPROTOCOL_WMSERVER) { $messageUidSet = array(); if ($this->DbStorage->Connect()) { $messageUidSet = $this->DbStorage->SelectAllMessagesUidSetByFolder($folder); } } if ($folder->SyncType != FOLDERSYNC_DirectMode) { if ($this->DbStorage->Connect()) { $result &= $this->DbStorage->PurgeFolder($folder); $result &= $this->DbStorage->UpdateMailboxSize(); } } switch ($this->_account->MailProtocol) { case MAILPROTOCOL_IMAP4: if ($folder->SyncType != FOLDERSYNC_DontSync) { if ($this->MailStorage->Connect()) { $result &= $this->MailStorage->PurgeFolder($folder); } } break; case MAILPROTOCOL_POP3: case MAILPROTOCOL_WMSERVER: if ($this->_account->MailMode == MAILMODE_DeleteMessageWhenItsRemovedFromTrash || $this->_account->MailMode == MAILMODE_KeepMessagesOnServerAndDeleteMessageWhenItsRemovedFromTrash) { $result &= $this->MailStorage->Connect() && $this->MailStorage->DeleteMessages($messageUidSet, true, $folder); } break; } //$fs->DeleteAccountDirs(); return $result; }
/** * @param Folder $folder * @return bool */ function PurgeFolder(&$folder) { $result = false; if ($this->_account->MailProtocol == MAILPROTOCOL_IMAP4) { $result = true; if ($folder->SyncType != FOLDERSYNC_DirectMode) { if ($this->DbStorage->Connect()) { $result &= $this->DbStorage->PurgeFolder($folder); $result &= $this->DbStorage->UpdateMailboxSize(); } } if ($folder->SyncType != FOLDERSYNC_DontSync) { if ($this->MailStorage->Connect()) { $result &= $this->MailStorage->PurgeFolder($folder); } } } return $result; }