Rename DI::httpRequest() into DI::httpClient()

This commit is contained in:
Philipp 2021-08-25 21:54:54 +02:00
parent 505100bdd7
commit 13a91e63aa
No known key found for this signature in database
GPG key ID: 9A28B7D4FF5667BD
38 changed files with 94 additions and 94 deletions

View file

@ -54,7 +54,7 @@ class CheckVersion
Logger::log("Checking VERSION from: ".$checked_url, Logger::DEBUG);
// fetch the VERSION file
$gitversion = DBA::escape(trim(DI::httpRequest()->fetch($checked_url)));
$gitversion = DBA::escape(trim(DI::httpClient()->fetch($checked_url)));
Logger::log("Upstream VERSION is: ".$gitversion, Logger::DEBUG);
DI::config()->set('system', 'git_friendica_version', $gitversion);

View file

@ -53,7 +53,7 @@ class Directory
Logger::log('Updating directory: ' . $arr['url'], Logger::DEBUG);
if (strlen($arr['url'])) {
DI::httpRequest()->fetch($dir . '?url=' . bin2hex($arr['url']));
DI::httpClient()->fetch($dir . '?url=' . bin2hex($arr['url']));
}
return;

View file

@ -34,7 +34,7 @@ class NodeInfo
// Now trying to register
$url = 'http://the-federation.info/register/' . DI::baseUrl()->getHostname();
Logger::debug('Check registering url', ['url' => $url]);
$ret = DI::httpRequest()->fetch($url);
$ret = DI::httpClient()->fetch($url);
Logger::debug('Check registering answer', ['answer' => $ret]);
Logger::info('end');
}

View file

@ -153,7 +153,7 @@ class OnePoll
}
$cookiejar = tempnam(get_temppath(), 'cookiejar-onepoll-');
$curlResult = DI::httpRequest()->get($contact['poll'], [HTTPClientOptions::COOKIEJAR => $cookiejar]);
$curlResult = DI::httpClient()->get($contact['poll'], [HTTPClientOptions::COOKIEJAR => $cookiejar]);
unlink($cookiejar);
if ($curlResult->isTimeout()) {
@ -459,7 +459,7 @@ class OnePoll
DBA::update('contact', ['hub-verify' => $verify_token], ['id' => $contact['id']]);
}
$postResult = DI::httpRequest()->post($url, $params);
$postResult = DI::httpClient()->post($url, $params);
Logger::info('Hub subscription done', ['result' => $postResult->getReturnCode()]);

View file

@ -68,7 +68,7 @@ class PubSubPublish
Logger::log('POST ' . print_r($headers, true) . "\n" . $params, Logger::DATA);
$postResult = DI::httpRequest()->post($subscriber['callback_url'], $params, $headers);
$postResult = DI::httpClient()->post($subscriber['callback_url'], $params, $headers);
$ret = $postResult->getReturnCode();
if ($ret >= 200 && $ret <= 299) {

View file

@ -47,7 +47,7 @@ class PullDirectory
Logger::info('Synchronization started.', ['now' => $now, 'directory' => $directory]);
$result = DI::httpRequest()->fetch($directory . '/sync/pull/since/' . $now);
$result = DI::httpClient()->fetch($directory . '/sync/pull/since/' . $now);
if (empty($result)) {
Logger::info('Directory server return empty result.', ['directory' => $directory]);
return;

View file

@ -46,7 +46,7 @@ class SearchDirectory
}
}
$x = DI::httpRequest()->fetch(Search::getGlobalDirectory() . '/lsearch?p=1&n=500&search=' . urlencode($search));
$x = DI::httpClient()->fetch(Search::getGlobalDirectory() . '/lsearch?p=1&n=500&search=' . urlencode($search));
$j = json_decode($x);
if (!empty($j->results)) {

View file

@ -45,7 +45,7 @@ class UpdateServerDirectory
private static function discoverPoCo(array $gserver)
{
$result = DI::httpRequest()->fetch($gserver['poco'] . '?fields=urls');
$result = DI::httpClient()->fetch($gserver['poco'] . '?fields=urls');
if (empty($result)) {
Logger::info('Empty result', ['url' => $gserver['url']]);
return;
@ -78,7 +78,7 @@ class UpdateServerDirectory
private static function discoverMastodonDirectory(array $gserver)
{
$result = DI::httpRequest()->fetch($gserver['url'] . '/api/v1/directory?order=new&local=true&limit=200&offset=0');
$result = DI::httpClient()->fetch($gserver['url'] . '/api/v1/directory?order=new&local=true&limit=200&offset=0');
if (empty($result)) {
Logger::info('Empty result', ['url' => $gserver['url']]);
return;

View file

@ -35,7 +35,7 @@ class UpdateServerPeers
*/
public static function execute(string $url)
{
$ret = DI::httpRequest()->get($url . '/api/v1/instance/peers');
$ret = DI::httpClient()->get($url . '/api/v1/instance/peers');
if (!$ret->isSuccess() || empty($ret->getBody())) {
Logger::info('Server is not reachable or does not offer the "peers" endpoint', ['url' => $url]);
return;