From 07795ae179b187592e050308913be1666c21208a Mon Sep 17 00:00:00 2001 From: Alexander Ebert Date: Mon, 20 Sep 2021 14:17:50 +0200 Subject: [PATCH] Skip the default cover photo when rebuilding users Fixes #4500 --- .../files/lib/system/worker/UserRebuildDataWorker.class.php | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/wcfsetup/install/files/lib/system/worker/UserRebuildDataWorker.class.php b/wcfsetup/install/files/lib/system/worker/UserRebuildDataWorker.class.php index f991414682..eeb12f0d76 100644 --- a/wcfsetup/install/files/lib/system/worker/UserRebuildDataWorker.class.php +++ b/wcfsetup/install/files/lib/system/worker/UserRebuildDataWorker.class.php @@ -6,6 +6,7 @@ use wcf\data\reaction\type\ReactionTypeCache; use wcf\data\user\avatar\UserAvatar; use wcf\data\user\avatar\UserAvatarEditor; use wcf\data\user\avatar\UserAvatarList; +use wcf\data\user\cover\photo\DefaultUserCoverPhoto; use wcf\data\user\cover\photo\IWebpUserCoverPhoto; use wcf\data\user\User; use wcf\data\user\UserEditor; @@ -300,6 +301,11 @@ class UserRebuildDataWorker extends AbstractRebuildDataWorker foreach ($userProfiles as $userProfile) { $editor = new UserEditor($userProfile->getDecoratedObject()); $coverPhoto = $userProfile->getCoverPhoto(true); + if ($coverPhoto instanceof DefaultUserCoverPhoto) { + // The default cover photo can be returned if the user has a + // cover photo, but it has been disabled by an administrator. + continue; + } // If neither the regular, nor the WebP variant is readable then the // cover photo is missing and we must clear the database information. -- 2.20.1