Merge pull request #10533 from annando/updatecontacts

Improved performance for UpdateContacts
This commit is contained in:
Hypolite Petovan 2021-07-21 11:22:13 -04:00 committed by GitHub
commit d738ff37b2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -55,9 +55,11 @@ class UpdateContacts
$ids = self::getContactsToUpdate($condition, [], $limit); $ids = self::getContactsToUpdate($condition, [], $limit);
Logger::info('Fetched federated user contacts', ['count' => count($ids)]); Logger::info('Fetched federated user contacts', ['count' => count($ids)]);
$conditions = ["`id` IN (SELECT `author-id` FROM `post-user`)", "`id` IN (SELECT `owner-id` FROM `post-user`)", $conditions = ["`id` IN (SELECT `author-id` FROM `post-user` WHERE `author-id` = `contact`.`id`)",
"`id` IN (SELECT `causer-id` FROM `post-user`)", "`id` IN (SELECT `cid` FROM `post-tag`)", "`id` IN (SELECT `owner-id` FROM `post-user` WHERE `owner-id` = `contact`.`id`)",
"`id` IN (SELECT `cid` FROM `user-contact`)"]; "`id` IN (SELECT `causer-id` FROM `post-user` WHERE `causer-id` = `contact`.`id`)",
"`id` IN (SELECT `cid` FROM `post-tag` WHERE `cid` = `contact`.`id`)",
"`id` IN (SELECT `cid` FROM `user-contact` WHERE `cid` = `contact`.`id`)"];
foreach ($conditions as $contact_condition) { foreach ($conditions as $contact_condition) {
$condition = DBA::mergeConditions($base_condition, $condition = DBA::mergeConditions($base_condition,