]> git.mxchange.org Git - friendica.git/commitdiff
Replace "Probe::isProbable" with "Protocol::supportsProbe"
authorMichael <heluecht@pirati.ca>
Wed, 17 May 2023 01:28:10 +0000 (01:28 +0000)
committerMichael <heluecht@pirati.ca>
Wed, 17 May 2023 01:28:10 +0000 (01:28 +0000)
src/Core/Protocol.php
src/Model/Contact.php

index 9890b8f285fdeaa94662039ff8226370f55fbf53..977684875731977775598294efccad1e2c727a55 100644 (file)
@@ -315,7 +315,12 @@ class Protocol
         */
        public static function supportsProbe($protocol): bool
        {
-               if (in_array($protocol, self::NATIVE_SUPPORT)) {
+               // "Mail" can only be probed for a specific user in a specific condition, so we are ignoring it here.
+               if ($protocol == self::MAIL) {
+                       return false;
+               }
+
+               if (in_array($protocol, array_merge(self::NATIVE_SUPPORT, [self::ZOT, self::PHANTOM]))) {
                        return true;
                }
 
index 648193b09cc2749e3c6b762ab63c2732f334ffad..d8f2448da2fef7dec2564523f1784ff1aacd1871 100644 (file)
@@ -361,7 +361,7 @@ class Contact
                $background_update = DI::config()->get('system', 'update_active_contacts') ? $contact['local-data'] : true;
 
                // Update the contact in the background if needed
-               if ($background_update && !self::isLocal($url) && Probe::isProbable($contact['network']) && ($contact['next-update'] < DateTimeFormat::utcNow())) {
+               if ($background_update && !self::isLocal($url) && Protocol::supportsProbe($contact['network']) && ($contact['next-update'] < DateTimeFormat::utcNow())) {
                        try {
                                UpdateContact::add(['priority' => Worker::PRIORITY_LOW, 'dont_fork' => true], $contact['id']);
                        } catch (\InvalidArgumentException $e) {
@@ -1279,7 +1279,7 @@ class Contact
 
                        $background_update = DI::config()->get('system', 'update_active_contacts') ? $contact['local-data'] : true;
 
-                       if ($background_update && !self::isLocal($url) && Probe::isProbable($contact['network']) && ($contact['next-update'] < DateTimeFormat::utcNow())) {
+                       if ($background_update && !self::isLocal($url) && Protocol::supportsProbe($contact['network']) && ($contact['next-update'] < DateTimeFormat::utcNow())) {
                                try {
                                        UpdateContact::add(['priority' => Worker::PRIORITY_LOW, 'dont_fork' => true], $contact['id']);
                                } catch (\InvalidArgumentException $e) {
@@ -2704,7 +2704,7 @@ class Contact
 
                $updated = DateTimeFormat::utcNow();
 
-               if (!Probe::isProbable($ret['network']) && !Probe::isProbable($contact['network'])) {
+               if (!Protocol::supportsProbe($ret['network']) && !Protocol::supportsProbe($contact['network'])) {
                        // Periodical checks are only done on federated contacts
                        $failed_next_update  = null;
                        $success_next_update = null;
@@ -3596,7 +3596,7 @@ class Contact
                        if (empty($contact['id']) && Network::isValidHttpUrl($url)) {
                                Worker::add(Worker::PRIORITY_LOW, 'AddContact', 0, $url);
                                ++$added;
-                       } elseif (!empty($contact['network']) && Probe::isProbable($contact['network']) && ($contact['next-update'] < DateTimeFormat::utcNow())) {
+                       } elseif (!empty($contact['network']) && Protocol::supportsProbe($contact['network']) && ($contact['next-update'] < DateTimeFormat::utcNow())) {
                                try {
                                        UpdateContact::add(['priority' => Worker::PRIORITY_LOW, 'dont_fork' => true], $contact['id']);
                                        ++$updated;