]> git.mxchange.org Git - friendica.git/commitdiff
Avoid warning in gcontact.php
authorMichael <heluecht@pirati.ca>
Thu, 12 Mar 2020 17:31:28 +0000 (17:31 +0000)
committerMichael <heluecht@pirati.ca>
Thu, 12 Mar 2020 17:31:28 +0000 (17:31 +0000)
src/Model/GContact.php

index 59c84bc4907b62a0950d22cf4b353441eb5c5062..5bcac5a013977c325bf8880be7531a2a265c508e 100644 (file)
@@ -1343,14 +1343,18 @@ class GContact
                        foreach ($contacts as $contact) {
                                $gcontact = DBA::selectFirst('gcontact', ['id'], ['nurl' => Strings::normaliseLink(($contact))]);
                                if (DBA::isResult($gcontact)) {
                        foreach ($contacts as $contact) {
                                $gcontact = DBA::selectFirst('gcontact', ['id'], ['nurl' => Strings::normaliseLink(($contact))]);
                                if (DBA::isResult($gcontact)) {
+                                       $field = [];
                                        if (in_array($contact, $followers)) {
                                                $fields = ['gcid' => $gcid, 'follower-gcid' => $gcontact['id']];
                                        } elseif (in_array($contact, $followings)) {
                                                $fields = ['gcid' => $gcontact['id'], 'follower-gcid' => $gcid];
                                        }
                                        if (in_array($contact, $followers)) {
                                                $fields = ['gcid' => $gcid, 'follower-gcid' => $gcontact['id']];
                                        } elseif (in_array($contact, $followings)) {
                                                $fields = ['gcid' => $gcontact['id'], 'follower-gcid' => $gcid];
                                        }
-                                       Logger::info('Set relation between contacts', $fields);
-                                       DBA::update('gfollower', ['deleted' => false], $fields, true);
-                                       continue;
+
+                                       if (!empty($fields)) {
+                                               Logger::info('Set relation between contacts', $fields);
+                                               DBA::update('gfollower', ['deleted' => false], $fields, true);
+                                               continue;
+                                       }
                                }
 
                                if (!Network::isUrlBlocked($contact)) {
                                }
 
                                if (!Network::isUrlBlocked($contact)) {