<instructions type="update" fromversion="5.4.2">
<instruction type="script" run="standalone">acp/update_com.woltlab.wcf_5.4.3_deleteDsStore.php</instruction>
+ <instruction type="script" run="standalone">acp/update_com.woltlab.wcf_5.4.3_resetAvatarCache.php</instruction>
</instructions>
</package>
--- /dev/null
+<?php
+
+/**
+ * Resets the user storage cache for avatars. These had not been updated after
+ * generating the WebP variants of avatars, causing the "old" avatar to be
+ * presented to the browser despite WebP being available.
+ *
+ * @author Alexander Ebert
+ * @copyright 2001-2021 WoltLab GmbH
+ * @license GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
+ * @package WoltLabSuite\Core
+ */
+
+use wcf\system\user\storage\UserStorageHandler;
+
+UserStorageHandler::getInstance()->resetAll('avatar');
use wcf\system\exception\SystemException;
use wcf\system\html\input\HtmlInputProcessor;
use wcf\system\image\ImageHandler;
+use wcf\system\user\storage\UserStorageHandler;
use wcf\system\WCF;
/**
]
);
$avatarList->readObjects();
+ $resetAvatarCache = [];
foreach ($avatarList as $avatar) {
+ $resetAvatarCache[] = $avatar->userID;
+
$editor = new UserAvatarEditor($avatar);
if (!\file_exists($avatar->getLocation()) || @\getimagesize($avatar->getLocation()) === false) {
// delete avatars that are missing or broken
]);
}
+ // Reset the avatar cache for all avatars that had been processed.
+ if (!empty($resetAvatarCache)) {
+ UserStorageHandler::getInstance()->reset($resetAvatarCache, 'avatar');
+ }
+
// Create WebP variants of existing cover photos.
$userProfiles = new UserProfileList();
$userProfiles->getConditionBuilder()->add("user_table.userID IN (?)", [$userIDs]);