]> git.mxchange.org Git - friendica.git/blobdiff - src/Worker/OnePoll.php
New function to fetch the database driver
[friendica.git] / src / Worker / OnePoll.php
index 40681175d466eb8e3fd89f29c03d55b3459293fd..93dff93ae5a8d1fe4aa1109349e48226809cdde8 100644 (file)
@@ -60,13 +60,13 @@ class OnePoll
                        return;
                }
 
-               if (($contact['network'] != Protocol::MAIL) || $force) {
-                       Contact::updateFromProbe($contact_id, '', $force);
+               if (($contact['network'] != Protocol::MAIL) && $force) {
+                       Contact::updateFromProbe($contact_id);
                }
 
                // Special treatment for wrongly detected local contacts
                if (!$force && ($contact['network'] != Protocol::DFRN) && Contact::isLocalById($contact_id)) {
-                       Contact::updateFromProbe($contact_id, Protocol::DFRN, true);
+                       Contact::updateFromProbe($contact_id, Protocol::DFRN);
                        $contact = DBA::selectFirst('contact', [], ['id' => $contact_id]);
                }
 
@@ -103,6 +103,15 @@ class OnePoll
                        return;
                }
 
+               // Don't poll local contacts
+               if (User::getIdForURL($contact['url'])) {
+                       Logger::info('Local contacts are not polled', ['id' => $contact['id']]);
+
+                       // set the last-update so we don't keep polling
+                       DBA::update('contact', ['last-update' => $updated], ['id' => $contact['id']]);
+                       return;
+               }               
+
                // We don't poll AP contacts by now
                if ($protocol === Protocol::ACTIVITYPUB) {
                        Logger::log("Don't poll AP contact");
@@ -435,7 +444,7 @@ class OnePoll
                }
 
                $cookiejar = tempnam(get_temppath(), 'cookiejar-onepoll-');
-               $curlResult = DI::httpRequest()->get($contact['poll'], false, ['cookiejar' => $cookiejar]);
+               $curlResult = DI::httpRequest()->get($contact['poll'], ['cookiejar' => $cookiejar]);
                unlink($cookiejar);
 
                if ($curlResult->isTimeout()) {
@@ -699,6 +708,9 @@ class OnePoll
                        Logger::log("Mail: no mails for ".$mailconf['user']);
                }
 
+               self::updateContact($contact, ['failed' => false, 'last-update' => $updated, 'success_update' => $updated]);
+               Contact::unmarkForArchival($contact);
+
                Logger::log("Mail: closing connection for ".$mailconf['user']);
                imap_close($mbox);
        }