mirror of
https://github.com/friendica/friendica
synced 2025-04-28 01:10:12 +00:00
Constantly updating public contacts
This commit is contained in:
parent
5306622225
commit
857469d16a
3 changed files with 50 additions and 12 deletions
|
@ -117,6 +117,9 @@ class Cron
|
|||
// Poll contacts
|
||||
self::pollContacts($parameter, $generation);
|
||||
|
||||
// Update contact information
|
||||
self::updatePublicContacts();
|
||||
|
||||
Logger::log('cron: end');
|
||||
|
||||
Config::set('system', 'last_cron', time());
|
||||
|
@ -124,6 +127,26 @@ class Cron
|
|||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Update public contacts
|
||||
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
|
||||
*/
|
||||
private static function updatePublicContacts() {
|
||||
$count = 0;
|
||||
$last_updated = DateTimeFormat::utc('now - 1 months');
|
||||
$condition = ["`network` IN (?, ?, ?, ?) AND `uid` = ? AND NOT `self` AND `last-update` < ?",
|
||||
Protocol::ACTIVITYPUB, Protocol::DFRN, Protocol::DIASPORA, Protocol::OSTATUS, 0, $last_updated];
|
||||
|
||||
$total = DBA::count('contact', $condition);
|
||||
$contacts = DBA::select('contact', ['id'], $condition, ['limit' => 1000]);
|
||||
while ($contact = DBA::fetch($contacts)) {
|
||||
Worker::add(PRIORITY_LOW, "UpdateContact", $contact['id'], 'force');
|
||||
++$count;
|
||||
}
|
||||
Logger::info('Initiated update for public contacts', ['interval' => $count, 'total' => $total]);
|
||||
DBA::close($contacts);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Poll contacts for unreceived messages
|
||||
*
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue