Rename DI::httpRequest() into DI::httpClient()
This commit is contained in:
@@ -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);
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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');
|
||||
}
|
||||
|
||||
@@ -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()]);
|
||||
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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)) {
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user