Issue 8675: reduce requests of foreign pages

This commit is contained in:
Michael 2020-06-01 21:52:31 +00:00
parent 4a363b50b4
commit e379698227
7 changed files with 51 additions and 47 deletions

View file

@ -276,15 +276,17 @@ class APContact
}
}
$parts = parse_url($apcontact['url']);
unset($parts['path']);
$baseurl = Network::unparseURL($parts);
if (empty($fetched_contact['baseurl']) || $update) {
$parts = parse_url($apcontact['url']);
unset($parts['path']);
$baseurl = Network::unparseURL($parts);
// Check if the address is resolvable or the profile url is identical with the base url of the system
if (self::addrToUrl($apcontact['addr'], $apcontact['url']) || Strings::compareLink($apcontact['url'], $baseurl)) {
$apcontact['baseurl'] = $baseurl;
} else {
$apcontact['addr'] = null;
// Check if the address is resolvable or the profile url is identical with the base url of the system
if (self::addrToUrl($apcontact['addr'], $apcontact['url']) || Strings::compareLink($apcontact['url'], $baseurl)) {
$apcontact['baseurl'] = $baseurl;
} else {
$apcontact['addr'] = null;
}
}
if (empty($apcontact['baseurl'])) {
@ -312,7 +314,7 @@ class APContact
DBA::delete('apcontact', ['url' => $url]);
}
Logger::log('Updated profile for ' . $url, Logger::DEBUG);
Logger::info('Updated profile', ['url' => $url]);
return $apcontact;
}

View file

@ -2085,7 +2085,7 @@ class Contact
// These fields aren't updated by this routine:
// 'xmpp', 'sensitive'
$fields = ['uid', 'avatar', 'name', 'nick', 'location', 'keywords', 'about',
$fields = ['uid', 'avatar', 'name', 'nick', 'location', 'keywords', 'about', 'subscribe',
'unsearchable', 'url', 'addr', 'batch', 'notify', 'poll', 'request', 'confirm', 'poco',
'network', 'alias', 'baseurl', 'gsid', 'forum', 'prv', 'contact-type', 'pubkey'];
$contact = DBA::selectFirst('contact', $fields, ['id' => $id]);

View file

@ -27,7 +27,6 @@ use Friendica\Content\Widget\ContactBlock;
use Friendica\Core\Cache\Duration;
use Friendica\Core\Hook;
use Friendica\Core\Logger;
use Friendica\Network\Probe;
use Friendica\Core\Protocol;
use Friendica\Core\Renderer;
use Friendica\Core\Session;
@ -772,7 +771,7 @@ class Profile
$_SESSION['visitor_handle'] = $visitor['addr'];
$_SESSION['visitor_home'] = $visitor['url'];
$_SESSION['my_url'] = $visitor['url'];
$_SESSION['remote_comment'] = Probe::getRemoteFollowLink($visitor['url']);
$_SESSION['remote_comment'] = $visitor['subscribe'];
Session::setVisitorsContacts();