]> git.mxchange.org Git - friendica.git/commitdiff
Ensure to reset the avatar paths when deleting avatar cache
authorMichael <heluecht@pirati.ca>
Sat, 14 Jan 2023 13:10:43 +0000 (13:10 +0000)
committerMichael <heluecht@pirati.ca>
Sat, 14 Jan 2023 13:10:43 +0000 (13:10 +0000)
src/Contact/Avatar.php
src/Model/Contact.php

index 7151acbfbd0190a6bb9bf8e63d1cce97f8f88503..e039a52799fc524e98f605cbb00ad51e198307a1 100644 (file)
@@ -246,13 +246,16 @@ class Avatar
         * Delete locally cached avatar pictures of a contact
         *
         * @param string $avatar
-        * @return void
+        * @return bool
         */
-       public static function deleteCache(array $contact)
+       public static function deleteCache(array $contact): bool
        {
+               $existed = (self::isCacheFile($contact['photo']) || self::isCacheFile($contact['thumb']) || self::isCacheFile($contact['micro']));
                self::deleteCacheFile($contact['photo']);
                self::deleteCacheFile($contact['thumb']);
                self::deleteCacheFile($contact['micro']);
+
+               return $existed;
        }
 
        /**
index 931ae3e4dcffb518439519e13e31919da06334ef..e847ce034666cf458ce7121363127af7f5d8eac1 100644 (file)
@@ -2252,7 +2252,9 @@ class Contact
                }
 
                if (in_array($contact['network'], [Protocol::FEED, Protocol::MAIL]) || $cache_avatar) {
-                       Avatar::deleteCache($contact);
+                       if (Avatar::deleteCache($contact)) {
+                               $force = true;
+                       }
 
                        if ($default_avatar && Proxy::isLocalImage($avatar)) {
                                $fields = ['avatar' => $avatar, 'avatar-date' => DateTimeFormat::utcNow(),