mirror of
https://github.com/friendica/friendica
synced 2025-04-27 15:10:11 +00:00
Merge pull request #8044 from annando/contact-adding
Don't add contacts when not needed
This commit is contained in:
commit
75c74e8562
6 changed files with 52 additions and 19 deletions
|
@ -269,29 +269,37 @@ class Contact
|
|||
* @brief Get the basepath for a given contact link
|
||||
*
|
||||
* @param string $url The contact link
|
||||
* @param boolean $dont_update Don't update the contact
|
||||
*
|
||||
* @return string basepath
|
||||
* @return boolean $dont_update Don't update the contact
|
||||
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
|
||||
* @throws \ImagickException
|
||||
*/
|
||||
public static function getBasepath($url, $dont_update = false)
|
||||
{
|
||||
$contact = DBA::selectFirst('contact', ['baseurl'], ['uid' => 0, 'nurl' => Strings::normaliseLink($url)]);
|
||||
$contact = DBA::selectFirst('contact', ['id', 'baseurl'], ['uid' => 0, 'nurl' => Strings::normaliseLink($url)]);
|
||||
if (!DBA::isResult($contact)) {
|
||||
return '';
|
||||
}
|
||||
|
||||
if (!empty($contact['baseurl'])) {
|
||||
return $contact['baseurl'];
|
||||
} elseif ($dont_update) {
|
||||
return '';
|
||||
}
|
||||
|
||||
self::updateFromProbeByURL($url, true);
|
||||
// Update the existing contact
|
||||
self::updateFromProbe($contact['id'], '', true);
|
||||
|
||||
$contact = DBA::selectFirst('contact', ['baseurl'], ['uid' => 0, 'nurl' => Strings::normaliseLink($url)]);
|
||||
if (!empty($contact['baseurl'])) {
|
||||
return $contact['baseurl'];
|
||||
// And fetch the result
|
||||
$contact = DBA::selectFirst('contact', ['baseurl'], ['id' => $contact['id']]);
|
||||
if (empty($contact['baseurl'])) {
|
||||
Logger::info('No baseurl for contact', ['url' => $url]);
|
||||
return '';
|
||||
}
|
||||
|
||||
return '';
|
||||
Logger::info('Found baseurl for contact', ['url' => $url, 'baseurl' => $contact['baseurl']]);
|
||||
return $contact['baseurl'];
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue