1
0
Fork 0

Merge pull request #11835 from annando/sql-fetchqueue

Improve SQL-Queries / fixed "fetch_parents" setting
This commit is contained in:
Tobias Diekershoff 2022-08-08 23:00:48 +02:00 committed by GitHub
commit 62be1c5614
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 8 additions and 8 deletions

View file

@ -345,7 +345,7 @@ class Processor
return [];
}
if (!in_array(0, $activity['receiver']) && !DI::config()->get('system', 'fetch_parents')) {
if (!in_array(0, $activity['receiver']) || !DI::config()->get('system', 'fetch_parents')) {
$fetch_parents = false;
}

View file

@ -39,7 +39,7 @@ class RemoveUnusedAvatars
AND NOT `nurl` IN (SELECT `nurl` FROM `contact` WHERE `uid` != ?)
AND NOT `contact`.`id` IN (SELECT `author-id` FROM `post-user`)
AND NOT `contact`.`id` IN (SELECT `owner-id` FROM `post-user`)
AND NOT `contact`.`id` IN (SELECT `causer-id` FROM `post-user`)
AND NOT `contact`.`id` IN (SELECT `causer-id` FROM `post-user` WHERE `causer-id` IS NOT NULL)
AND NOT `contact`.`id` IN (SELECT `cid` FROM `post-tag`)
AND NOT `contact`.`id` IN (SELECT `contact-id` FROM `post-user`);";

View file

@ -40,7 +40,7 @@ class RemoveUnusedContacts
$condition = ["`id` != ? AND `uid` = ? AND NOT `self` AND NOT `nurl` IN (SELECT `nurl` FROM `contact` WHERE `uid` != ?)
AND (NOT `network` IN (?, ?, ?, ?, ?, ?) OR (`archive` AND `success_update` < ?))
AND NOT `id` IN (SELECT `author-id` FROM `post-user`) AND NOT `id` IN (SELECT `owner-id` FROM `post-user`)
AND NOT `id` IN (SELECT `causer-id` FROM `post-user`) AND NOT `id` IN (SELECT `cid` FROM `post-tag`)
AND NOT `id` IN (SELECT `causer-id` FROM `post-user` WHERE `causer-id` IS NOT NULL) AND NOT `id` IN (SELECT `cid` FROM `post-tag`)
AND NOT `id` IN (SELECT `contact-id` FROM `post-user`) AND NOT `id` IN (SELECT `cid` FROM `user-contact`)
AND NOT `id` IN (SELECT `cid` FROM `event`) AND NOT `id` IN (SELECT `contact-id` FROM `group_member`)
AND `created` < ?",

View file

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