]> git.mxchange.org Git - friendica.git/commitdiff
Remove apcontact and diaspora-contact entries that aren't connected to contacts
authorMichael <heluecht@pirati.ca>
Thu, 15 Aug 2024 04:17:14 +0000 (04:17 +0000)
committerMichael <heluecht@pirati.ca>
Thu, 15 Aug 2024 04:17:14 +0000 (04:17 +0000)
src/Worker/RemoveUnusedContacts.php

index f6d651cdb335453d0521b35ab8bee6fd2839aeb2..e95b0a0bf86027f43895cd8aca262059d03f61d1 100644 (file)
@@ -89,5 +89,13 @@ class RemoveUnusedContacts
                }
                DBA::close($contacts);
                Logger::notice('Removal done', ['count' => $count, 'total' => $total]);
+               
+               Logger::notice('Remove apcontact entries with no related contact');
+               DBA::delete('apcontact', ["`uri-id` NOT IN (SELECT `uri-id` FROM `contact`) AND `updated` < ?", DateTimeFormat::utc('now - 30 days')]);
+               Logger::notice('Removed apcontact entries with no related contact', ['count' => DBA::affectedRows()]);
+
+               Logger::notice('Remove diaspora-contact entries with no related contact');
+               DBA::delete('diaspora-contact', ["`uri-id` NOT IN (SELECT `uri-id` FROM `contact`) AND `updated` < ?", DateTimeFormat::utc('now - 30 days')]);
+               Logger::notice('Removed diaspora-contact entries with no related contact', ['count' => DBA::affectedRows()]);
        }
 }