From 0dd6ea0c1260efa5ba1b058cb7a7e36b1d7d848d Mon Sep 17 00:00:00 2001 From: Marcel Werk Date: Wed, 22 May 2013 15:11:49 +0200 Subject: [PATCH] Added missing cleanup --- .../files/lib/data/user/UserAction.class.php | 42 ++++++++++++++++++- 1 file changed, 41 insertions(+), 1 deletion(-) diff --git a/wcfsetup/install/files/lib/data/user/UserAction.class.php b/wcfsetup/install/files/lib/data/user/UserAction.class.php index 21ad975873..a96d19efdd 100644 --- a/wcfsetup/install/files/lib/data/user/UserAction.class.php +++ b/wcfsetup/install/files/lib/data/user/UserAction.class.php @@ -1,5 +1,7 @@ __validateAccessibleGroups(); } + /** + * @see wcf\data\IDeleteAction::delete() + */ + public function delete() { + if (empty($this->objects)) { + $this->readObjects(); + } + + // delete avatars + $avatarIDs = array(); + foreach ($this->objects as $user) { + if ($user->avatarID) $avatarIDs[] = $user->avatarID; + } + if (!empty($avatarIDs)) { + $action = new UserAvatarAction($avatarIDs, 'delete'); + $action->executeAction(); + } + + // delete profile comments + if (!empty($this->objectIDs)) { + $objectType = ObjectTypeCache::getInstance()->getObjectTypeByName('com.woltlab.wcf.comment.commentableContent', 'com.woltlab.wcf.user.profileComment'); + $conditionBuilder = new PreparedStatementConditionBuilder(); + $conditionBuilder->add('objectTypeID = ?', array($objectType->objectTypeID)); + $conditionBuilder->add('objectID IN (?)', array($this->objectIDs)); + + $sql = "DELETE FROM wcf".WCF_N."_comment + ".$conditionBuilder; + $statement = WCF::getDB()->prepareStatement($sql); + $statement->execute($conditionBuilder->getParameters()); + } + + $returnValue = parent::delete(); + + return $returnValue; + } + /** * Validates permissions and parameters. */ @@ -272,7 +310,9 @@ class UserAction extends AbstractDatabaseObjectAction implements IClipboardActio } } - + /** + * Add users to given groups. + */ public function addToGroups() { if (empty($this->objects)) { $this->readObjects(); -- 2.20.1