]> git.mxchange.org Git - friendica.git/blobdiff - src/Worker/UpdateContacts.php
Merge pull request #10094 from urbalazs/license-20210328
[friendica.git] / src / Worker / UpdateContacts.php
index 86959c88bbbf56cf0e7cd2e6cb1eea4002926fa9..c11cf07a25b359398d664e9d0c649bec8543acf0 100644 (file)
@@ -50,7 +50,7 @@ class UpdateContacts
                }
 
                $condition = DBA::mergeConditions($base_condition,
-                       ["`uid` != ? AND (`last-update` < ? OR (NOT `archive` AND `last-update` < ?))",
+                       ["`uid` != ? AND (`last-update` < ? OR (NOT `failed` AND `last-update` < ?))",
                        0, DateTimeFormat::utc('now - 1 month'), DateTimeFormat::utc('now - 1 week')]);
                $ids = self::getContactsToUpdate($condition, [], $limit);
                Logger::info('Fetched federated user contacts', ['count' => count($ids)]);
@@ -61,7 +61,7 @@ class UpdateContacts
 
                foreach ($conditions as $contact_condition) {
                        $condition = DBA::mergeConditions($base_condition,
-                               [$contact_condition . " AND (`last-update` < ? OR (NOT `archive` AND `last-update` < ?))",
+                               [$contact_condition . " AND (`last-update` < ? OR (NOT `failed` AND `last-update` < ?))",
                                DateTimeFormat::utc('now - 1 month'), DateTimeFormat::utc('now - 1 week')]);
                        $ids = self::getContactsToUpdate($condition, $ids, $limit);
                        Logger::info('Fetched interacting federated contacts', ['count' => count($ids), 'condition' => $contact_condition]);
@@ -75,7 +75,7 @@ class UpdateContacts
                        // Add every contact (mostly failed ones) that hadn't been updated for six months
                        // and every non failed contact that hadn't been updated for a month
                        $condition = DBA::mergeConditions($base_condition,
-                               ["(`last-update` < ? OR (NOT `archive` AND `last-update` < ?))",
+                               ["(`last-update` < ? OR (NOT `failed` AND `last-update` < ?))",
                                        DateTimeFormat::utc('now - 6 month'), DateTimeFormat::utc('now - 1 month')]);
                        $previous = count($ids);
                        $ids = self::getContactsToUpdate($condition, $ids, $limit - $previous);
@@ -101,7 +101,7 @@ class UpdateContacts
         */
        private static function getContactsToUpdate(array $condition, array $ids = [], int $limit)
        {
-               $contacts = DBA::select('contact', ['id'], $condition, ['limit' => $limit, 'order' => ['last-update']]);
+               $contacts = DBA::select('contact', ['id'], $condition, ['limit' => $limit]);
                while ($contact = DBA::fetch($contacts)) {
                        $ids[$contact['id']] = $contact['id'];
                }