Removed unused PoCo functionality
This commit is contained in:
parent
a54675b597
commit
23b7da3664
3 changed files with 24 additions and 175 deletions
|
@ -1653,18 +1653,4 @@ class GServer
|
|||
|
||||
DI::config()->set('poco', 'last_federation_discovery', time());
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a list of 1,000 active servers order by the last contact
|
||||
*
|
||||
* @return array List of server urls
|
||||
* @throws Exception
|
||||
*/
|
||||
public static function getActive()
|
||||
{
|
||||
$result = DBA::p("SELECT `url`, `site_name` AS `displayName`, `network`, `platform`, `version` FROM `gserver`
|
||||
WHERE `network` IN (?, ?, ?, ?) AND NOT `failed` ORDER BY `last_contact` LIMIT ?",
|
||||
Protocol::DFRN, Protocol::DIASPORA, Protocol::OSTATUS, Protocol::ACTIVITYPUB, 1000);
|
||||
return DBA::toArray($result);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -63,41 +63,4 @@ class UpdateServerPeers
|
|||
}
|
||||
Logger::info('Server peer update ended', ['total' => $total, 'added' => $added, 'url' => $url]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Fetch server list from remote servers and adds them when they are new.
|
||||
*
|
||||
* @param string $poco URL to the POCO endpoint
|
||||
*/
|
||||
private static function fetchServerlist($poco)
|
||||
{
|
||||
$curlResult = DI::httpRequest()->get($poco . '/@server');
|
||||
if (!$curlResult->isSuccess()) {
|
||||
Logger::info('Server is not reachable or does not offer the "poco" endpoint', ['poco' => $poco]);
|
||||
return;
|
||||
}
|
||||
|
||||
$serverlist = json_decode($curlResult->getBody(), true);
|
||||
if (!is_array($serverlist)) {
|
||||
Logger::info('Server does not have any servers listed', ['poco' => $poco]);
|
||||
return;
|
||||
}
|
||||
|
||||
Logger::info('PoCo Server update start', ['poco' => $poco]);
|
||||
|
||||
$total = 0;
|
||||
$added = 0;
|
||||
foreach ($serverlist as $server) {
|
||||
++$total;
|
||||
if (DBA::exists('gserver', ['nurl' => Strings::normaliseLink($server['url'])])) {
|
||||
// We already know this server
|
||||
continue;
|
||||
}
|
||||
// This endpoint doesn't offer the schema. So we assume that it is HTTPS.
|
||||
Worker::add(PRIORITY_LOW, 'UpdateGServer', $server['url']);
|
||||
++$added;
|
||||
}
|
||||
|
||||
Logger::info('PoCo Server update ended', ['total' => $total, 'added' => $added, 'poco' => $poco]);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue