From c143158a639ca7befb187d209f87f48f594e1bbd Mon Sep 17 00:00:00 2001 From: Marcel Werk Date: Sun, 28 Mar 2021 14:13:50 +0200 Subject: [PATCH] Delete trophy images when deleting tropies --- .../install/files/lib/data/trophy/TrophyAction.class.php | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/wcfsetup/install/files/lib/data/trophy/TrophyAction.class.php b/wcfsetup/install/files/lib/data/trophy/TrophyAction.class.php index cc38faae26..d745216d19 100644 --- a/wcfsetup/install/files/lib/data/trophy/TrophyAction.class.php +++ b/wcfsetup/install/files/lib/data/trophy/TrophyAction.class.php @@ -88,7 +88,13 @@ class TrophyAction extends AbstractDatabaseObjectAction implements IToggleAction $userTrophyAction = new UserTrophyAction($userTrophyList->getObjects(), 'delete'); $userTrophyAction->executeAction(); - + + foreach ($this->getObjects() as $trophy) { + if ($trophy->iconFile) { + @unlink(WCF_DIR . 'images/trophy/' . $trophy->iconFile); + } + } + $returnValues = parent::delete(); UserStorageHandler::getInstance()->resetAll('specialTrophies'); -- 2.20.1