]> git.mxchange.org Git - friendica.git/commitdiff
Rename "fetchUrl" and "fetchUrlFull" to "fetch" and "fetchFull"
authornupplaPhil <admin+github@philipp.info>
Wed, 4 Mar 2020 21:35:40 +0000 (22:35 +0100)
committerHypolite Petovan <hypolite@mrpetovan.com>
Tue, 21 Jul 2020 07:15:53 +0000 (03:15 -0400)
20 files changed:
mod/dfrn_poll.php
mod/dfrn_request.php
mod/oexchange.php
mod/pubsubhubbub.php
src/Content/OEmbed.php
src/Content/Text/BBCode.php
src/Core/Installer.php
src/Core/Search.php
src/Core/Worker.php
src/Model/GContact.php
src/Model/GServer.php
src/Module/Debug/Feed.php
src/Network/HTTPRequest.php
src/Protocol/Diaspora.php
src/Protocol/PortableContact.php
src/Util/Images.php
src/Worker/CheckVersion.php
src/Worker/CronJobs.php
src/Worker/Directory.php
src/Worker/SearchDirectory.php

index 7f7fbe498f8ff39e6ad9ae04055f133c660aa65e..183f6022e3d275550587eca957ca5f794cc28c9a 100644 (file)
@@ -114,7 +114,7 @@ function dfrn_poll_init(App $a)
                );
 
                if (DBA::isResult($r)) {
-                       $s = DI::httpRequest()->fetchUrl($r[0]['poll'] . '?dfrn_id=' . $my_id . '&type=profile-check');
+                       $s = DI::httpRequest()->fetch($r[0]['poll'] . '?dfrn_id=' . $my_id . '&type=profile-check');
 
                        Logger::log("dfrn_poll: old profile returns " . $s, Logger::DATA);
 
@@ -498,12 +498,12 @@ function dfrn_poll_content(App $a)
 
                        // URL reply
                        if ($dfrn_version < 2.2) {
-                               $s = DI::httpRequest()->fetchUrl($r[0]['poll']
-                                                          . '?dfrn_id=' . $encrypted_id
-                                                          . '&type=profile-check'
-                                                          . '&dfrn_version=' . DFRN_PROTOCOL_VERSION
-                                                          . '&challenge=' . $challenge
-                                                          . '&sec=' . $sec
+                               $s = DI::httpRequest()->fetch($r[0]['poll']
+                                                             . '?dfrn_id=' . $encrypted_id
+                                                             . '&type=profile-check'
+                                                             . '&dfrn_version=' . DFRN_PROTOCOL_VERSION
+                                                             . '&challenge=' . $challenge
+                                                             . '&sec=' . $sec
                                );
                        } else {
                                $s = DI::httpRequest()->post($r[0]['poll'], [
index 8c8557650ed55efd3a8831688c976a246ad444f8..cb21a211f920d9eae21e0c080875736b4bd48fe0 100644 (file)
@@ -203,7 +203,7 @@ function dfrn_request_post(App $a)
                                }
 
                                if (!empty($dfrn_request) && strlen($confirm_key)) {
-                                       DI::httpRequest()->fetchUrl($dfrn_request . '?confirm_key=' . $confirm_key);
+                                       DI::httpRequest()->fetch($dfrn_request . '?confirm_key=' . $confirm_key);
                                }
 
                                // (ignore reply, nothing we can do it failed)
index 4746651c16985262ff3732bc00deac1ac8d9cc65..b8da9df7ef323d563f04e64a5b57fb3d059c39cf 100644 (file)
@@ -57,7 +57,7 @@ function oexchange_content(App $a) {
        $tags = ((!empty($_REQUEST['tags']))
                ? '&tags=' . urlencode(Strings::escapeTags(trim($_REQUEST['tags']))) : '');
 
-       $s = DI::httpRequest()->fetchUrl(DI::baseUrl() . '/parse_url?url=' . $url . $title . $description . $tags);
+       $s = DI::httpRequest()->fetch(DI::baseUrl() . '/parse_url?url=' . $url . $title . $description . $tags);
 
        if (!strlen($s)) {
                return;
index 96f26838ed7c7a71c99e24a52da5e0adf398aaf1..3445436182b40ddb5ada3430a3b4ab261a79b82d 100644 (file)
@@ -24,7 +24,6 @@ use Friendica\Core\Logger;
 use Friendica\Database\DBA;
 use Friendica\DI;
 use Friendica\Model\PushSubscriber;
-use Friendica\Network\HTTPRequest;
 use Friendica\Util\Strings;
 
 function post_var($name) {
@@ -126,7 +125,7 @@ function pubsubhubbub_init(App $a) {
                $hub_callback = rtrim($hub_callback, ' ?&#');
                $separator = parse_url($hub_callback, PHP_URL_QUERY) === null ? '?' : '&';
 
-               $fetchResult = DI::httpRequest()->fetchUrlFull($hub_callback . $separator . $params);
+               $fetchResult = DI::httpRequest()->fetchFull($hub_callback . $separator . $params);
                $body = $fetchResult->getBody();
                $ret = $fetchResult->getReturnCode();
 
index 592d25c10d249bb00de2a8c4d28de077ab1e1a74..30a113f461414b336fc37dafa3ef0af345aa0204 100644 (file)
@@ -95,7 +95,7 @@ class OEmbed
 
                        if (!in_array($ext, $noexts)) {
                                // try oembed autodiscovery
-                               $html_text = DI::httpRequest()->fetchUrl($embedurl, false, 15, 'text/*');
+                               $html_text = DI::httpRequest()->fetch($embedurl, false, 15, 'text/*');
                                if ($html_text) {
                                        $dom = @DOMDocument::loadHTML($html_text);
                                        if ($dom) {
@@ -103,14 +103,14 @@ class OEmbed
                                                $entries = $xpath->query("//link[@type='application/json+oembed']");
                                                foreach ($entries as $e) {
                                                        $href = $e->getAttributeNode('href')->nodeValue;
-                                                       $json_string = DI::httpRequest()->fetchUrl($href . '&maxwidth=' . $a->videowidth);
+                                                       $json_string = DI::httpRequest()->fetch($href . '&maxwidth=' . $a->videowidth);
                                                        break;
                                                }
 
                                                $entries = $xpath->query("//link[@type='text/json+oembed']");
                                                foreach ($entries as $e) {
                                                        $href = $e->getAttributeNode('href')->nodeValue;
-                                                       $json_string = DI::httpRequest()->fetchUrl($href . '&maxwidth=' . $a->videowidth);
+                                                       $json_string = DI::httpRequest()->fetch($href . '&maxwidth=' . $a->videowidth);
                                                        break;
                                                }
                                        }
index bf208a103608a95ed44e59ef8f299e59c9739c0a..1181c8f47bc2a66e4dc4ccedbbb20381e22827c8 100644 (file)
@@ -1106,7 +1106,7 @@ class BBCode
                                $text = "[url=" . $match[2] . ']' . $match[2] . "[/url]";
 
                                // if its not a picture then look if its a page that contains a picture link
-                               $body = DI::httpRequest()->fetchUrl($match[1]);
+                               $body = DI::httpRequest()->fetch($match[1]);
 
                                $doc = new DOMDocument();
                                @$doc->loadHTML($body);
@@ -1185,7 +1185,7 @@ class BBCode
                        }
 
                        // if its not a picture then look if its a page that contains a picture link
-                       $body = DI::httpRequest()->fetchUrl($match[1]);
+                       $body = DI::httpRequest()->fetch($match[1]);
 
                        $doc = new DOMDocument();
                        @$doc->loadHTML($body);
index af7c7aa496ace48c8c2d0182cbfde69b53710db3..28db93d292de706f36a01ca76912f9cac51b24f3 100644 (file)
@@ -27,7 +27,6 @@ use Friendica\Core\Config\Cache;
 use Friendica\Database\Database;
 use Friendica\Database\DBStructure;
 use Friendica\DI;
-use Friendica\Network\HTTPRequest;
 use Friendica\Util\Images;
 use Friendica\Util\Strings;
 
@@ -548,11 +547,11 @@ class Installer
                $help = "";
                $error_msg = "";
                if (function_exists('curl_init')) {
-                       $fetchResult = DI::httpRequest()->fetchUrlFull($baseurl . "/install/testrewrite");
+                       $fetchResult = DI::httpRequest()->fetchFull($baseurl . "/install/testrewrite");
 
                        $url = Strings::normaliseLink($baseurl . "/install/testrewrite");
                        if ($fetchResult->getReturnCode() != 204) {
-                               $fetchResult = DI::httpRequest()->fetchUrlFull($url);
+                               $fetchResult = DI::httpRequest()->fetchFull($url);
                        }
 
                        if ($fetchResult->getReturnCode() != 204) {
index c5c6ca08c24aac01726fede4f7468e1af4d6ce95..577b11266e77b4fdab1fd65c1929fbdb68a231b4 100644 (file)
@@ -123,7 +123,7 @@ class Search
                        $searchUrl .= '&page=' . $page;
                }
 
-               $resultJson = DI::httpRequest()->fetchUrl($searchUrl, false, 0, 'application/json');
+               $resultJson = DI::httpRequest()->fetch($searchUrl, false, 0, 'application/json');
 
                $results = json_decode($resultJson, true);
 
index 83a24c38fe79cbd1e9665358d571df5c51549df9..937dd0a56582dc76b44e59b468a6793f5e6bb3d9 100644 (file)
@@ -996,7 +996,7 @@ class Worker
                }
 
                $url = DI::baseUrl() . '/worker';
-               DI::httpRequest()->fetchUrl($url, false, 1);
+               DI::httpRequest()->fetch($url, false, 1);
        }
 
        /**
index 109f5d54b3b41a519f9954b595ad3c92261fe1da..ab0a4fdd84438c692d15c90e01174d352d16156c 100644 (file)
@@ -536,7 +536,7 @@ class GContact
                $done[] = DI::baseUrl() . '/poco';
 
                if (strlen(DI::config()->get('system', 'directory'))) {
-                       $x = DI::httpRequest()->fetchUrl(Search::getGlobalDirectory() . '/pubsites');
+                       $x = DI::httpRequest()->fetch(Search::getGlobalDirectory() . '/pubsites');
                        if (!empty($x)) {
                                $j = json_decode($x);
                                if (!empty($j->entries)) {
index ae4332511d50ff00debbe9eb8104f57890d3f2ea..7643c9590e43fbb9210a823f9c31886e43e55b74 100644 (file)
@@ -1634,7 +1634,7 @@ class GServer
                $protocols = ['activitypub', 'diaspora', 'dfrn', 'ostatus'];
                foreach ($protocols as $protocol) {
                        $query = '{nodes(protocol:"' . $protocol . '"){host}}';
-                       $curlResult = DI::httpRequest()->fetchUrl('https://the-federation.info/graphql?query=' . urlencode($query));
+                       $curlResult = DI::httpRequest()->fetch('https://the-federation.info/graphql?query=' . urlencode($query));
                        if (!empty($curlResult)) {
                                $data = json_decode($curlResult, true);
                                if (!empty($data['data']['nodes'])) {
index deeb8d7ec350fdc241df79090584466ce0a6fe35..1da0457c457f2408fd0844a3d201793c0022d646 100644 (file)
@@ -48,7 +48,7 @@ class Feed extends BaseModule
 
                        $contact = Model\Contact::getByURLForUser($url, local_user(), false);
 
-                       $xml = DI::httpRequest()->fetchUrl($contact['poll']);
+                       $xml = DI::httpRequest()->fetch($contact['poll']);
 
                        $import_result = Protocol\Feed::import($xml);
 
index f9279fa6028473711a543e4c12ead24cab0e484b..c751406c1bf911de72f62c84a3e3ce66e0222f01 100644 (file)
@@ -460,9 +460,9 @@ class HTTPRequest
         * @return string The fetched content
         * @throws \Friendica\Network\HTTPException\InternalServerErrorException
         */
-       public function fetchUrl(string $url, bool $binary = false, int $timeout = 0, string $accept_content = '', string $cookiejar = '', int &$redirects = 0)
+       public function fetch(string $url, bool $binary = false, int $timeout = 0, string $accept_content = '', string $cookiejar = '', int &$redirects = 0)
        {
-               $ret = $this->fetchUrlFull($url, $binary, $timeout, $accept_content, $cookiejar, $redirects);
+               $ret = $this->fetchFull($url, $binary, $timeout, $accept_content, $cookiejar, $redirects);
 
                return $ret->getBody();
        }
@@ -484,7 +484,7 @@ class HTTPRequest
         * @return CurlResult With all relevant information, 'body' contains the actual fetched content.
         * @throws \Friendica\Network\HTTPException\InternalServerErrorException
         */
-       public function fetchUrlFull(string $url, bool $binary = false, int $timeout = 0, string $accept_content = '', string $cookiejar = '', int &$redirects = 0)
+       public function fetchFull(string $url, bool $binary = false, int $timeout = 0, string $accept_content = '', string $cookiejar = '', int &$redirects = 0)
        {
                return $this->get(
                        $url,
index 5e1f09677375b5690e77acbb742a01960c4415b1..98a315ce21741c508fdd40e43af63b508c7e579c 100644 (file)
@@ -1379,7 +1379,7 @@ class Diaspora
 
                Logger::log("Fetch post from ".$source_url, Logger::DEBUG);
 
-               $envelope = DI::httpRequest()->fetchUrl($source_url);
+               $envelope = DI::httpRequest()->fetch($source_url);
                if ($envelope) {
                        Logger::log("Envelope was fetched.", Logger::DEBUG);
                        $x = self::verifyMagicEnvelope($envelope);
index 5216e39370c626e616363dcfd3957484c2ffcdf0..cfc140d66d9a45e03993010e1e29a6b2972ae3bf 100644 (file)
@@ -102,7 +102,7 @@ class PortableContact
 
                Logger::log('load: ' . $url, Logger::DEBUG);
 
-               $fetchresult = DI::httpRequest()->fetchUrlFull($url);
+               $fetchresult = DI::httpRequest()->fetchFull($url);
                $s = $fetchresult->getBody();
 
                Logger::log('load: returns ' . $s, Logger::DATA);
index 2d161a5c43232e8e3590dff6021dd3343f13a173..ef171873f2f9d4ca5666e694b4cc97c8cd1ff5ee 100644 (file)
@@ -184,7 +184,7 @@ class Images
                        return $data;
                }
 
-               $img_str = DI::httpRequest()->fetchUrl($url, true, 4);
+               $img_str = DI::httpRequest()->fetch($url, true, 4);
 
                if (!$img_str) {
                        return [];
index 260d6b16f25898d230486913d1c2758f6312e1a9..be325461b0f77cb2b7fea0a20f3be0dc70b81da0 100644 (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()->fetchUrl($checked_url)));
+               $gitversion = DBA::escape(trim(DI::httpRequest()->fetch($checked_url)));
                Logger::log("Upstream VERSION is: ".$gitversion, Logger::DEBUG);
 
                DI::config()->set('system', 'git_friendica_version', $gitversion);
index 1e450585694a81df4f25d35845ef221db95ab139..4f988b6e14392174a02b6aad9f04e52b71d9107b 100644 (file)
@@ -60,7 +60,7 @@ class CronJobs
                                // Now trying to register
                                $url = 'http://the-federation.info/register/' . DI::baseUrl()->getHostname();
                                Logger::debug('Check registering url', ['url' => $url]);
-                               $ret = DI::httpRequest()->fetchUrl($url);
+                               $ret = DI::httpRequest()->fetch($url);
                                Logger::debug('Check registering answer', ['answer' => $ret]);
                                Logger::info('cron_end');
                                break;
index 2cab09f3392fc7ebe497a277974e04fc6a139235..d71e593dc5673c7b4de59a399ac21e658c051b9f 100644 (file)
@@ -53,7 +53,7 @@ class Directory
 
                Logger::log('Updating directory: ' . $arr['url'], Logger::DEBUG);
                if (strlen($arr['url'])) {
-                       DI::httpRequest()->fetchUrl($dir . '?url=' . bin2hex($arr['url']));
+                       DI::httpRequest()->fetch($dir . '?url=' . bin2hex($arr['url']));
                }
 
                return;
index c3c344d93caf077afe47f1e80588c6d8df9b8212..546c369b2c5569952deaed0a663e3f5aa281a789 100644 (file)
@@ -51,7 +51,7 @@ class SearchDirectory
                        }
                }
 
-               $x = DI::httpRequest()->fetchUrl(Search::getGlobalDirectory() . '/lsearch?p=1&n=500&search=' . urlencode($search));
+               $x = DI::httpRequest()->fetch(Search::getGlobalDirectory() . '/lsearch?p=1&n=500&search=' . urlencode($search));
                $j = json_decode($x);
 
                if (!empty($j->results)) {