]> git.mxchange.org Git - friendica.git/blobdiff - src/Worker/OnePoll.php
Fix: Feeds and mail accounts hadn't been fetched reliably
[friendica.git] / src / Worker / OnePoll.php
index fbd1ab4e59f9fd608f2b2330ac087459ec13c3f5..5fc65b211a1d4f4414d896c64ef1d64c5f737f97 100644 (file)
@@ -32,7 +32,6 @@ use Friendica\Protocol\Activity;
 use Friendica\Protocol\ActivityPub;
 use Friendica\Protocol\Email;
 use Friendica\Protocol\Feed;
-use Friendica\Protocol\PortableContact;
 use Friendica\Util\DateTimeFormat;
 use Friendica\Util\Strings;
 use Friendica\Util\XML;
@@ -61,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]);
                }
 
@@ -95,13 +94,6 @@ class OnePoll
                        $contact = DBA::selectFirst('contact', [], ['id' => $contact_id]);
                }
 
-               // load current friends if possible.
-               if (!empty($contact['poco']) && !$contact['failed']) {
-                       if (!DBA::exists('glink', ["`cid` = ? AND updated > UTC_TIMESTAMP() - INTERVAL 1 DAY", $contact['id']])) {
-                               PortableContact::loadWorker($contact['id'], $importer_uid, 0, $contact['poco']);
-                       }
-               }
-
                // Don't poll if polling is deactivated (But we poll feeds and mails anyway)
                if (!in_array($protocol, [Protocol::FEED, Protocol::MAIL]) && DI::config()->get('system', 'disable_polling')) {
                        Logger::log('Polling is disabled');
@@ -111,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");
@@ -707,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);
        }