]> git.mxchange.org Git - friendica.git/commitdiff
Only update when changed
authorMichael <heluecht@pirati.ca>
Mon, 26 Mar 2018 06:17:50 +0000 (06:17 +0000)
committerMichael <heluecht@pirati.ca>
Mon, 26 Mar 2018 06:17:50 +0000 (06:17 +0000)
src/Protocol/PortableContact.php

index 9c7ad538ccc167f52b36be292572946b16c709e1..e66cb4687cf92044b81caba62af56497d07f72ce 100644 (file)
@@ -1379,7 +1379,7 @@ class PortableContact
                }
 
                if (!$failure && in_array($fields['network'], [NETWORK_DFRN, NETWORK_DIASPORA])) {
-                       self::discoverRelay(server_url);
+                       self::discoverRelay($server_url);
                }
 
                logger("End discovery for server " . $server_url, LOGGER_DEBUG);
@@ -1401,13 +1401,15 @@ class PortableContact
                        return;
                }
 
-               $gserver = dba::selectFirst('gserver', ['id'], ['nurl' => normalise_link($server_url)]);
+               $gserver = dba::selectFirst('gserver', ['id', 'relay-subscribe', 'relay-scope'], ['nurl' => normalise_link($server_url)]);
                if (!DBM::is_result($gserver)) {
                        return;
                }
 
-               $fields = ['relay-subscribe' => $data->subscribe, 'relay-scope' => $data->scope];
-               dba::update('gserver', $fields, ['id' => $gserver['id']]);
+               if (($gserver['relay-subscribe'] != $data->subscribe) || ($gserver['relay-scope'] != $data->scope)) {
+                       $fields = ['relay-subscribe' => $data->subscribe, 'relay-scope' => $data->scope];
+                       dba::update('gserver', $fields, ['id' => $gserver['id']]);
+               }
 
                dba::delete('gserver-tag', ['gserver-id' => $gserver['id']]);
                if ($data->scope == 'tags') {