From: Marcel Werk Date: Wed, 22 May 2013 13:11:49 +0000 (+0200) Subject: Added missing cleanup X-Git-Tag: 2.0.0_Beta_1~94 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=0dd6ea0c1260efa5ba1b058cb7a7e36b1d7d848d;p=GitHub%2FWoltLab%2FWCF.git Added missing cleanup --- 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();