From: Michael Date: Mon, 9 May 2022 06:57:47 +0000 (+0000) Subject: More avatar handling isolation X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=006b7a95f0d7a789556603848d3bbac0a666fcde;p=friendica.git More avatar handling isolation --- diff --git a/src/Contact/Avatar.php b/src/Contact/Avatar.php index f4e5b71afe..18f63b07b2 100644 --- a/src/Contact/Avatar.php +++ b/src/Contact/Avatar.php @@ -129,7 +129,7 @@ class Avatar * @param string $avatar * @return boolean */ - public static function isCacheFile(string $avatar): bool + private static function isCacheFile(string $avatar): bool { return !empty(self::getCacheFile($avatar)); } diff --git a/src/Model/Contact.php b/src/Model/Contact.php index c83bf1f416..6a98286994 100644 --- a/src/Model/Contact.php +++ b/src/Model/Contact.php @@ -1581,10 +1581,14 @@ class Contact self::updateAvatar($cid, $contact['avatar'], true); return; } - } elseif (!Avatar::isCacheFile($contact['photo']) || !Avatar::isCacheFile($contact['thumb']) || !Avatar::isCacheFile($contact['micro'])) { - Logger::info('Removing/replacing avatar cache', ['id' => $cid, 'contact' => $contact]); + } elseif (Photo::isPhotoURI($contact['photo']) || Photo::isPhotoURI($contact['thumb']) || Photo::isPhotoURI($contact['micro'])) { + Logger::info('Replacing legacy avatar cache', ['id' => $cid, 'contact' => $contact]); self::updateAvatar($cid, $contact['avatar'], true); return; + } elseif (DI::config()->get('system', 'avatar_cache') && (empty($contact['photo']) || empty($contact['thumb']) || empty($contact['micro']))) { + Logger::info('Adding avatar cache file', ['id' => $cid, 'contact' => $contact]); + self::updateAvatar($cid, $contact['avatar'], true); + return; } }