Don't poll locally / user self data
This commit is contained in:
parent
eb95314aaa
commit
3d1829ede5
|
@ -1576,12 +1576,20 @@ class Contact
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$local_uid = User::getIdForURL($contact['url']);
|
||||||
|
if (!empty($local_uid)) {
|
||||||
|
$fields = self::selectFirst(['avatar', 'avatar-date', 'photo', 'thumb', 'micro'], ['self' => true, 'uid' => $local_uid]);
|
||||||
|
}
|
||||||
|
|
||||||
// Replace cached avatar pictures from the default avatar with the default avatars in different sizes
|
// Replace cached avatar pictures from the default avatar with the default avatars in different sizes
|
||||||
if (strpos($avatar, self::DEFAULT_AVATAR_PHOTO)) {
|
if (strpos($avatar, self::DEFAULT_AVATAR_PHOTO)) {
|
||||||
$fields = ['avatar' => $avatar, 'avatar-date' => DateTimeFormat::utcNow(),
|
$fields = ['avatar' => $avatar, 'avatar-date' => DateTimeFormat::utcNow(),
|
||||||
'photo' => DI::baseUrl() . self::DEFAULT_AVATAR_PHOTO,
|
'photo' => DI::baseUrl() . self::DEFAULT_AVATAR_PHOTO,
|
||||||
'thumb' => DI::baseUrl() . self::DEFAULT_AVATAR_THUMB,
|
'thumb' => DI::baseUrl() . self::DEFAULT_AVATAR_THUMB,
|
||||||
'micro' => DI::baseUrl() . self::DEFAULT_AVATAR_MICRO];
|
'micro' => DI::baseUrl() . self::DEFAULT_AVATAR_MICRO];
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!empty($fields)) {
|
||||||
if ($fields['photo'] . $fields['thumb'] . $fields['micro'] != $contact['photo'] . $contact['thumb'] . $contact['micro']) {
|
if ($fields['photo'] . $fields['thumb'] . $fields['micro'] != $contact['photo'] . $contact['thumb'] . $contact['micro']) {
|
||||||
DBA::update('contact', $fields, ['id' => $cid]);
|
DBA::update('contact', $fields, ['id' => $cid]);
|
||||||
Photo::delete(['uid' => $uid, 'contact-id' => $cid, 'album' => Photo::CONTACT_PHOTOS]);
|
Photo::delete(['uid' => $uid, 'contact-id' => $cid, 'album' => Photo::CONTACT_PHOTOS]);
|
||||||
|
|
|
@ -103,6 +103,15 @@ class OnePoll
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Don't poll local contacts
|
||||||
|
if (Contact::isLocalById($contact['id'])) {
|
||||||
|
Logger::info('Local contacts are not polled', ['id' => $contact['id']]);
|
||||||
|
|
||||||
|
// set the last-update so we don't keep polling
|
||||||
|
DBA::update('contact', ['last-update' => $updated], ['id' => $contact['id']]);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// We don't poll AP contacts by now
|
// We don't poll AP contacts by now
|
||||||
if ($protocol === Protocol::ACTIVITYPUB) {
|
if ($protocol === Protocol::ACTIVITYPUB) {
|
||||||
Logger::log("Don't poll AP contact");
|
Logger::log("Don't poll AP contact");
|
||||||
|
|
Loading…
Reference in a new issue