mirror of
https://github.com/friendica/friendica
synced 2025-02-24 13:18:13 +00:00
Reduce cyclomatic complexity in GServer::detect()
This commit is contained in:
parent
6684f0d5c7
commit
d55830902b
1 changed files with 19 additions and 11 deletions
|
@ -815,6 +815,25 @@ class GServer
|
||||||
}
|
}
|
||||||
|
|
||||||
// Count the number of known contacts from this server
|
// Count the number of known contacts from this server
|
||||||
|
self::countNumberOfKnownContacts((int) $id, $serverdata);
|
||||||
|
|
||||||
|
if (in_array($serverdata['network'], [Protocol::DFRN, Protocol::DIASPORA])) {
|
||||||
|
self::discoverRelay($url);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!empty($systemactor)) {
|
||||||
|
$contact = Contact::getByURL($systemactor, true, ['gsid', 'baseurl', 'id', 'network', 'url', 'name']);
|
||||||
|
Logger::debug('Fetched system actor', ['url' => $url, 'gsid' => $id, 'contact' => $contact]);
|
||||||
|
}
|
||||||
|
|
||||||
|
return $ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Count the number of known contacts from this server
|
||||||
|
*/
|
||||||
|
private static function countNumberOfKnownContacts(int $id, array $serverdata): void
|
||||||
|
{
|
||||||
if (!empty($id) && !in_array($serverdata['network'], [Protocol::PHANTOM, Protocol::FEED])) {
|
if (!empty($id) && !in_array($serverdata['network'], [Protocol::PHANTOM, Protocol::FEED])) {
|
||||||
$apcontacts = DBA::count('apcontact', ['gsid' => $id]);
|
$apcontacts = DBA::count('apcontact', ['gsid' => $id]);
|
||||||
$contacts = DBA::count('contact', ['uid' => 0, 'gsid' => $id, 'failed' => false]);
|
$contacts = DBA::count('contact', ['uid' => 0, 'gsid' => $id, 'failed' => false]);
|
||||||
|
@ -840,17 +859,6 @@ class GServer
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (in_array($serverdata['network'], [Protocol::DFRN, Protocol::DIASPORA])) {
|
|
||||||
self::discoverRelay($url);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!empty($systemactor)) {
|
|
||||||
$contact = Contact::getByURL($systemactor, true, ['gsid', 'baseurl', 'id', 'network', 'url', 'name']);
|
|
||||||
Logger::debug('Fetched system actor', ['url' => $url, 'gsid' => $id, 'contact' => $contact]);
|
|
||||||
}
|
|
||||||
|
|
||||||
return $ret;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Add table
Reference in a new issue