mirror of
https://github.com/friendica/friendica
synced 2025-04-27 15:10:11 +00:00
Ensure that local contacts always are DFRN contacts
This commit is contained in:
parent
7db4c7ea02
commit
ccc7a71e54
5 changed files with 52 additions and 9 deletions
|
@ -314,6 +314,29 @@ class Contact
|
|||
return Strings::compareLink(self::getBasepath($url, true), DI::baseUrl());
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if the given contact ID is on the same server
|
||||
*
|
||||
* @param string $url The contact link
|
||||
*
|
||||
* @return boolean Is it the same server?
|
||||
*/
|
||||
public static function isLocalById(int $cid)
|
||||
{
|
||||
$contact = DBA::selectFirst('contact', ['url', 'baseurl'], ['id' => $cid]);
|
||||
if (!DBA::isResult($contact)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (empty($contact['baseurl'])) {
|
||||
$baseurl = self::getBasepath($contact['url'], true);
|
||||
} else {
|
||||
$baseurl = $contact['baseurl'];
|
||||
}
|
||||
|
||||
return Strings::compareLink($baseurl, DI::baseUrl());
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the public contact id of the given user id
|
||||
*
|
||||
|
@ -2126,6 +2149,12 @@ class Contact
|
|||
if ($force) {
|
||||
self::updateContact($id, $uid, $ret['url'], ['last-update' => $updated, 'success_update' => $updated]);
|
||||
}
|
||||
|
||||
// Update the public contact
|
||||
if ($uid != 0) {
|
||||
self::updateFromProbeByURL($ret['url']);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue