]> git.mxchange.org Git - friendica.git/commitdiff
Implement code review from nupplaphil
authorMatthew Exon <git.mexon@spamgourmet.com>
Sat, 11 Jan 2020 15:00:02 +0000 (16:00 +0100)
committerMatthew Exon <git.mexon@spamgourmet.com>
Sat, 11 Jan 2020 15:01:58 +0000 (16:01 +0100)
src/Model/Contact.php
src/Model/Mail.php
src/Model/Photo.php

index 7722b6990956e825b3116233779ae339e4f30ac1..e6c00b1e3c6e1fa518d6cb86a154d55153f8edef 100644 (file)
@@ -1899,7 +1899,7 @@ class Contact
                foreach ($data as $image_uri) {
                        $image_rid = Photo::ridFromURI($image_uri);
                        if ($image_rid && !Photo::exists(['resource-id' => $image_rid, 'uid' => $uid])) {
-                               Logger::info('Regenerating avatar for contact uid ' . $uid . ' cid ' . $cid . ' missing photo ' . $image_rid . ' avatar ' . $contact['avatar']);
+                               Logger::info('Regenerating avatar', ['contact uid' => $uid, 'cid' => $cid, 'missing photo' => $image_rid, 'avatar' => $contact['avatar']]);
                                $force = true;
                        }
                }
index da72d7d51f39d8c07916a6b3cb47adae5cd6d305..292d797b85415018b63535a8826da8f6595683ce 100644 (file)
@@ -216,7 +216,7 @@ class Mail
                        if (count($images)) {
                                foreach ($images as $image) {
                                        $image_rid = Photo::ridFromURI($image);
-                                       if ($image_rid) {
+                                       if (!empty($image_rid)) {
                                                Photo::update(['allow-cid' => '<' . $recipient . '>'], ['resource-id' => $image_rid, 'album' => 'Wall Photos', 'uid' => local_user()]);
                                        }
                                }
index 801ef25fba567218f9dacebd364a44fb0883c0ef..8b65c0d0e044761b5a6574a00f4d82eb260f6dda 100644 (file)
@@ -605,12 +605,12 @@ class Photo
        public static function ridFromURI($image_uri)
        {
                if (!stristr($image_uri, DI::baseUrl() . '/photo/')) {
-                       return;
+                       return '';
                }
                $image_uri = substr($image_uri, strrpos($image_uri, '/') + 1);
                $image_uri = substr($image_uri, 0, strpos($image_uri, '-'));
                if (!strlen($image_uri)) {
-                       return;
+                       return '';
                }
                return $image_uri;
        }
@@ -642,7 +642,7 @@ class Photo
 
                foreach ($images as $image) {
                        $image_rid = self::ridFromURI($image);
-                       if (!$image_rid) {
+                       if (empty($image_rid)) {
                                continue;
                        }