use wcf\data\file\File;
use wcf\data\file\FileAction;
-use wcf\data\user\avatar\UserAvatarAction;
use wcf\data\user\User;
use wcf\data\user\UserEditor;
use wcf\system\user\group\assignment\UserGroupAssignmentHandler;
use wcf\system\user\UserProfileHandler;
use wcf\system\WCF;
+/**
+ * Sets the avatar of a user.
+ *
+ * @author Olaf Braun
+ * @copyright 2001-2024 WoltLab GmbH
+ * @license GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
+ * @since 6.2
+ */
final class SetAvatar
{
public function __construct(
(new FileAction([$this->user->avatarFileID], 'delete'))->executeAction();
}
- // Delete old `UserAvatar` object if provided
- if ($this->user->avatarID) {
- (new UserAvatarAction([$this->user->avatarID], 'delete'))->executeAction();
- }
-
(new UserEditor($this->user))->update([
'avatarFileID' => $this->file?->fileID,
'avatarID' => null,