]> git.mxchange.org Git - friendica.git/blobdiff - src/Worker/PollContacts.php
Merge pull request #12320 from annando/issue-11553a
[friendica.git] / src / Worker / PollContacts.php
index 078cf202a5380fd7fc77d34b4670e631a3256003..454b5a9aea46c80335825b4bf39543eb8d7fe808 100644 (file)
@@ -1,6 +1,6 @@
 <?php
 /**
- * @copyright Copyright (C) 2020, Friendica
+ * @copyright Copyright (C) 2010-2022, the Friendica project
  *
  * @license GNU AGPL version 3 or any later version
  *
@@ -41,12 +41,11 @@ class PollContacts
                        $abandon_days = 0;
                }
 
-               $condition = ['network' => [Protocol::DFRN, Protocol::ACTIVITYPUB, Protocol::OSTATUS, Protocol::FEED, 
-                       Protocol::MAIL, Protocol::ZOT, Protocol::PHANTOM], 'self' => false, 'blocked' => false];
+               $condition = ['network' => [Protocol::FEED, Protocol::MAIL, Protocol::OSTATUS], 'self' => false, 'blocked' => false];
 
                if (!empty($abandon_days)) {
                        $condition = DBA::mergeConditions($condition,
-                               ["`uid` != ? AND `uid` IN (SELECT `uid` FROM `user` WHERE NOT `account_expired` AND NOT `account_removed`  AND `login_date` > UTC_TIMESTAMP() - INTERVAL ? DAY)", 0, $abandon_days]);
+                               ["`uid` != ? AND `uid` IN (SELECT `uid` FROM `user` WHERE NOT `account_expired` AND NOT `account_removed`  AND `login_date` > ?)", 0, DateTimeFormat::utc('now - ' . $abandon_days . ' days')]);
                } else  {
                        $condition = DBA::mergeConditions($condition,
                                ["`uid` != ? AND `uid` IN (SELECT `uid` FROM `user` WHERE NOT `account_expired` AND NOT `account_removed`)", 0]);
@@ -72,16 +71,17 @@ class PollContacts
                        }
 
                        if ((($contact['network'] == Protocol::FEED) && ($contact['priority'] <= 3)) || ($contact['network'] == Protocol::MAIL)) {
-                               $priority = PRIORITY_MEDIUM;
+                               $priority = Worker::PRIORITY_MEDIUM;
                        } elseif ($contact['archive']) {
-                               $priority = PRIORITY_NEGLIGIBLE;
+                               $priority = Worker::PRIORITY_NEGLIGIBLE;
                        } else {
-                               $priority = PRIORITY_LOW;
+                               $priority = Worker::PRIORITY_LOW;
                        }
 
                        Logger::notice("Polling " . $contact["network"] . " " . $contact["id"] . " " . $contact['priority'] . " " . $contact["nick"] . " " . $contact["name"]);
 
                        Worker::add(['priority' => $priority, 'dont_fork' => true, 'force_priority' => true], 'OnePoll', (int)$contact['id']);
+                       Worker::coolDown();
                }
                DBA::close($contacts);
        }