]> git.mxchange.org Git - friendica.git/commitdiff
Only update public contacts that are in use
authorMichael <heluecht@pirati.ca>
Sun, 27 Sep 2020 11:55:31 +0000 (11:55 +0000)
committerMichael <heluecht@pirati.ca>
Sun, 27 Sep 2020 11:55:31 +0000 (11:55 +0000)
src/Worker/UpdatePublicContacts.php
static/defaults.config.php

index 453606bfa08d22931dc9428d6007c25c6fc257f2..519478e1110af74e29676e07964250a389653ee8 100644 (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']]);
index fbd3787b7607830815fe3d06a9d29e7e63243425..11731f214894f18d937ed4e65f019cbfe5765ea3 100644 (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.