Delete trophy images when deleting tropies
authorMarcel Werk <burntime@woltlab.com>
Sun, 28 Mar 2021 12:13:50 +0000 (14:13 +0200)
committerMarcel Werk <burntime@woltlab.com>
Sun, 28 Mar 2021 12:13:50 +0000 (14:13 +0200)
wcfsetup/install/files/lib/data/trophy/TrophyAction.class.php

index cc38faae2632c4cb9c1f14980505864785da1493..d745216d199f999e0114695644e559cd93b1bf62 100644 (file)
@@ -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');