Пример #1
0
 /**
  *
  * @param array $conversationIdList
  * @return array<MAILBOX_BOL_Attachment>
  */
 public function deleteAttachmentsByConversationList(array $conversationIdList)
 {
     $attachmentList = $this->attachmentDao->findAttachmentstByConversationList($conversationIdList);
     foreach ($attachmentList as $attachment) {
         $ext = UTIL_File::getExtension($attachment['fileName']);
         $path = $this->getAttachmentFilePath($attachment['id'], $attachment['hash'], $ext);
         if (OW::getStorage()->removeFile($path)) {
             $this->attachmentDao->deleteById($attachment['id']);
         }
     }
 }
Пример #2
0
 public function deleteAttachmentFiles()
 {
     $attachDtoList = $this->attachmentDao->getAttachmentForDelete();
     foreach ($attachDtoList as $attachDto) {
         /* @var $attachDto MAILBOX_BOL_Attachment */
         $ext = UTIL_File::getExtension($attachDto->fileName);
         $attachmentPath = $this->getAttachmentFilePath($attachDto->id, $attachDto->hash, $ext, $attachDto->fileName);
         try {
             OW::getStorage()->removeFile($attachmentPath);
             $this->attachmentDao->deleteById($attachDto->id);
         } catch (Exception $ex) {
         }
     }
 }