Skip to content

Commit

Permalink
Merge pull request #5947 from WoltLab/delete-files-after-attachment-d…
Browse files Browse the repository at this point in the history
…eleted

Also delete the associated file when an attachment is deleted
  • Loading branch information
Cyperghost committed Jun 17, 2024
2 parents 3b9604d + 7848ec7 commit 84df99b
Showing 1 changed file with 4 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
namespace wcf\data\attachment;

use wcf\data\DatabaseObjectEditor;
use wcf\data\file\File;
use wcf\data\file\FileEditor;
use wcf\system\database\util\PreparedStatementConditionBuilder;
use wcf\system\WCF;

Expand Down Expand Up @@ -65,6 +67,8 @@ public static function deleteAll(array $objectIDs = [])
public function deleteFiles()
{
if ($this->fileID !== null) {
$fileEditor = new FileEditor(new File($this->fileID));
$fileEditor->delete();
return;
}

Expand Down

0 comments on commit 84df99b

Please sign in to comment.