/** * @param string $pluginKey * @param string $bundle */ public function deleteAttachmentByBundle($pluginKey, $bundle) { $attachments = $this->attachmentDao->findAttahcmentByBundle($pluginKey, $bundle); /* @var $attach BOL_Attachment */ foreach ($attachments as $attach) { OW::getStorage()->removeFile($this->getAttachmentsDir() . $attach->getFileName()); $this->attachmentDao->delete($attach); } }
public function deleteAttachmentByUrl($url) { $attch = $this->attachmentDao->findAttachmentByFileName(trim(basename($url))); if ($attch != NULL) { if (OW::getStorage()->fileExists($this->getAttachmentsDir() . $attch->getFileName())) { OW::getStorage()->removeFile($this->getAttachmentsDir() . $attch->getFileName()); } $this->attachmentDao->delete($attch); } else { if (OW::getStorage()->fileExists($this->getAttachmentsDir() . basename($url))) { OW::getStorage()->removeFile($this->getAttachmentsDir() . basename($url)); } } }