Merge pull request #9297 from annando/updates-used-public-contacts

Only update public contacts that are in use
This commit is contained in:
Tobias Diekershoff 2020-09-27 14:22:52 +02:00 committed by GitHub
commit 9702b1d679
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 11 additions and 0 deletions

View file

@ -25,6 +25,7 @@ use Friendica\Core\Logger;
use Friendica\Core\Protocol;
use Friendica\Core\Worker;
use Friendica\Database\DBA;
use Friendica\DI;
use Friendica\Util\DateTimeFormat;
/**
@ -39,6 +40,12 @@ class UpdatePublicContacts
$condition = ["`network` IN (?, ?, ?, ?) AND `uid` = ? AND NOT `self` AND `last-update` < ?",
Protocol::ACTIVITYPUB, Protocol::DFRN, Protocol::DIASPORA, Protocol::OSTATUS, 0, $last_updated];
if (DI::config()->get('system', 'update_active_contacts')) {
$condition = DBA::mergeConditions($condition, ["(`id` IN (SELECT `author-id` FROM `item`) OR
`id` IN (SELECT `owner-id` FROM `item`) OR `id` IN (SELECT `causer-id` FROM `item`) OR
`id` IN (SELECT `cid` FROM `post-tag`) OR `id` IN (SELECT `cid` FROM `user-contact`))"]);
}
$oldest_date = '';
$oldest_id = '';
$contacts = DBA::select('contact', ['id', 'last-update'], $condition, ['limit' => 100, 'order' => ['last-update']]);

View file

@ -475,6 +475,10 @@ return [
// Maximum number of posts that a user can send per month with the API. 0 to disable monthly throttling.
'throttle_limit_month' => 0,
// update_active_contacts (Boolean)
// When activated, only public contacts will be activated regularly that are used for example in items or tags.
'update_active_contacts' => false,
// username_min_length (Integer)
// The minimum character length a username can be.
// This length is check once the username has been trimmed and multiple spaces have been collapsed into one.