Merge pull request #5592 from annando/avoid-probe

Avoid probing for contacts if we don't want to update
This commit is contained in:
Tobias Diekershoff 2018-08-09 09:16:11 +02:00 committed by GitHub
commit 13384ff933
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -849,7 +849,24 @@ class Contact extends BaseObject
return 0;
}
// When we don't want to update, we look if some of our users already know this contact
if ($no_update) {
$fields = ['url', 'addr', 'alias', 'notify', 'poll', 'name', 'nick',
'photo', 'keywords', 'location', 'about', 'network',
'priority', 'batch', 'request', 'confirm', 'poco'];
$data = DBA::selectFirst('contact', $fields, ['nurl' => normalise_link($url)]);
if (DBA::isResult($data)) {
// For security reasons we don't fetch key data from our users
$data["pubkey"] = '';
}
} else {
$data = [];
}
if (empty($data)) {
$data = Probe::uri($url, "", $uid);
}
// Last try in gcontact for unsupported networks
if (!in_array($data["network"], [NETWORK_DFRN, NETWORK_OSTATUS, NETWORK_DIASPORA, NETWORK_PUMPIO, NETWORK_MAIL, NETWORK_FEED])) {