Make "HTTPRequest::fetchUrl" dynamic
This commit is contained in:
parent
3b4cf87c95
commit
1aa07f87a4
20 changed files with 26 additions and 46 deletions
|
@ -25,7 +25,6 @@ use Friendica\Core\Session;
|
||||||
use Friendica\Core\System;
|
use Friendica\Core\System;
|
||||||
use Friendica\Database\DBA;
|
use Friendica\Database\DBA;
|
||||||
use Friendica\DI;
|
use Friendica\DI;
|
||||||
use Friendica\Network\HTTPRequest;
|
|
||||||
use Friendica\Protocol\DFRN;
|
use Friendica\Protocol\DFRN;
|
||||||
use Friendica\Protocol\OStatus;
|
use Friendica\Protocol\OStatus;
|
||||||
use Friendica\Util\Strings;
|
use Friendica\Util\Strings;
|
||||||
|
@ -115,7 +114,7 @@ function dfrn_poll_init(App $a)
|
||||||
);
|
);
|
||||||
|
|
||||||
if (DBA::isResult($r)) {
|
if (DBA::isResult($r)) {
|
||||||
$s = HTTPRequest::fetchUrl($r[0]['poll'] . '?dfrn_id=' . $my_id . '&type=profile-check');
|
$s = DI::httpRequest()->fetchUrl($r[0]['poll'] . '?dfrn_id=' . $my_id . '&type=profile-check');
|
||||||
|
|
||||||
Logger::log("dfrn_poll: old profile returns " . $s, Logger::DATA);
|
Logger::log("dfrn_poll: old profile returns " . $s, Logger::DATA);
|
||||||
|
|
||||||
|
@ -499,7 +498,7 @@ function dfrn_poll_content(App $a)
|
||||||
|
|
||||||
// URL reply
|
// URL reply
|
||||||
if ($dfrn_version < 2.2) {
|
if ($dfrn_version < 2.2) {
|
||||||
$s = HTTPRequest::fetchUrl($r[0]['poll']
|
$s = DI::httpRequest()->fetchUrl($r[0]['poll']
|
||||||
. '?dfrn_id=' . $encrypted_id
|
. '?dfrn_id=' . $encrypted_id
|
||||||
. '&type=profile-check'
|
. '&type=profile-check'
|
||||||
. '&dfrn_version=' . DFRN_PROTOCOL_VERSION
|
. '&dfrn_version=' . DFRN_PROTOCOL_VERSION
|
||||||
|
|
|
@ -39,7 +39,6 @@ use Friendica\Model\Notify\Type;
|
||||||
use Friendica\Model\Profile;
|
use Friendica\Model\Profile;
|
||||||
use Friendica\Model\User;
|
use Friendica\Model\User;
|
||||||
use Friendica\Module\Security\Login;
|
use Friendica\Module\Security\Login;
|
||||||
use Friendica\Network\HTTPRequest;
|
|
||||||
use Friendica\Network\Probe;
|
use Friendica\Network\Probe;
|
||||||
use Friendica\Protocol\Activity;
|
use Friendica\Protocol\Activity;
|
||||||
use Friendica\Util\DateTimeFormat;
|
use Friendica\Util\DateTimeFormat;
|
||||||
|
@ -204,7 +203,7 @@ function dfrn_request_post(App $a)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!empty($dfrn_request) && strlen($confirm_key)) {
|
if (!empty($dfrn_request) && strlen($confirm_key)) {
|
||||||
HTTPRequest::fetchUrl($dfrn_request . '?confirm_key=' . $confirm_key);
|
DI::httpRequest()->fetchUrl($dfrn_request . '?confirm_key=' . $confirm_key);
|
||||||
}
|
}
|
||||||
|
|
||||||
// (ignore reply, nothing we can do it failed)
|
// (ignore reply, nothing we can do it failed)
|
||||||
|
|
|
@ -23,7 +23,6 @@ use Friendica\App;
|
||||||
use Friendica\Core\Renderer;
|
use Friendica\Core\Renderer;
|
||||||
use Friendica\DI;
|
use Friendica\DI;
|
||||||
use Friendica\Module\Security\Login;
|
use Friendica\Module\Security\Login;
|
||||||
use Friendica\Network\HTTPRequest;
|
|
||||||
use Friendica\Util\Strings;
|
use Friendica\Util\Strings;
|
||||||
|
|
||||||
function oexchange_init(App $a) {
|
function oexchange_init(App $a) {
|
||||||
|
@ -58,7 +57,7 @@ function oexchange_content(App $a) {
|
||||||
$tags = ((!empty($_REQUEST['tags']))
|
$tags = ((!empty($_REQUEST['tags']))
|
||||||
? '&tags=' . urlencode(Strings::escapeTags(trim($_REQUEST['tags']))) : '');
|
? '&tags=' . urlencode(Strings::escapeTags(trim($_REQUEST['tags']))) : '');
|
||||||
|
|
||||||
$s = HTTPRequest::fetchUrl(DI::baseUrl() . '/parse_url?url=' . $url . $title . $description . $tags);
|
$s = DI::httpRequest()->fetchUrl(DI::baseUrl() . '/parse_url?url=' . $url . $title . $description . $tags);
|
||||||
|
|
||||||
if (!strlen($s)) {
|
if (!strlen($s)) {
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -31,7 +31,6 @@ use Friendica\Core\Hook;
|
||||||
use Friendica\Core\Renderer;
|
use Friendica\Core\Renderer;
|
||||||
use Friendica\Database\DBA;
|
use Friendica\Database\DBA;
|
||||||
use Friendica\DI;
|
use Friendica\DI;
|
||||||
use Friendica\Network\HTTPRequest;
|
|
||||||
use Friendica\Util\DateTimeFormat;
|
use Friendica\Util\DateTimeFormat;
|
||||||
use Friendica\Util\Network;
|
use Friendica\Util\Network;
|
||||||
use Friendica\Util\ParseUrl;
|
use Friendica\Util\ParseUrl;
|
||||||
|
@ -96,7 +95,7 @@ class OEmbed
|
||||||
|
|
||||||
if (!in_array($ext, $noexts)) {
|
if (!in_array($ext, $noexts)) {
|
||||||
// try oembed autodiscovery
|
// try oembed autodiscovery
|
||||||
$html_text = HTTPRequest::fetchUrl($embedurl, false, 15, 'text/*');
|
$html_text = DI::httpRequest()->fetchUrl($embedurl, false, 15, 'text/*');
|
||||||
if ($html_text) {
|
if ($html_text) {
|
||||||
$dom = @DOMDocument::loadHTML($html_text);
|
$dom = @DOMDocument::loadHTML($html_text);
|
||||||
if ($dom) {
|
if ($dom) {
|
||||||
|
@ -104,14 +103,14 @@ class OEmbed
|
||||||
$entries = $xpath->query("//link[@type='application/json+oembed']");
|
$entries = $xpath->query("//link[@type='application/json+oembed']");
|
||||||
foreach ($entries as $e) {
|
foreach ($entries as $e) {
|
||||||
$href = $e->getAttributeNode('href')->nodeValue;
|
$href = $e->getAttributeNode('href')->nodeValue;
|
||||||
$json_string = HTTPRequest::fetchUrl($href . '&maxwidth=' . $a->videowidth);
|
$json_string = DI::httpRequest()->fetchUrl($href . '&maxwidth=' . $a->videowidth);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
$entries = $xpath->query("//link[@type='text/json+oembed']");
|
$entries = $xpath->query("//link[@type='text/json+oembed']");
|
||||||
foreach ($entries as $e) {
|
foreach ($entries as $e) {
|
||||||
$href = $e->getAttributeNode('href')->nodeValue;
|
$href = $e->getAttributeNode('href')->nodeValue;
|
||||||
$json_string = HTTPRequest::fetchUrl($href . '&maxwidth=' . $a->videowidth);
|
$json_string = DI::httpRequest()->fetchUrl($href . '&maxwidth=' . $a->videowidth);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -38,7 +38,6 @@ use Friendica\Model\Contact;
|
||||||
use Friendica\Model\Event;
|
use Friendica\Model\Event;
|
||||||
use Friendica\Model\Photo;
|
use Friendica\Model\Photo;
|
||||||
use Friendica\Model\Tag;
|
use Friendica\Model\Tag;
|
||||||
use Friendica\Network\HTTPRequest;
|
|
||||||
use Friendica\Object\Image;
|
use Friendica\Object\Image;
|
||||||
use Friendica\Protocol\Activity;
|
use Friendica\Protocol\Activity;
|
||||||
use Friendica\Util\Images;
|
use Friendica\Util\Images;
|
||||||
|
@ -486,7 +485,7 @@ class BBCode
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
$curlResult = HTTPRequest::curl($mtch[1], true);
|
$curlResult = DI::httpRequest()->curl($mtch[1], true);
|
||||||
if (!$curlResult->isSuccess()) {
|
if (!$curlResult->isSuccess()) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
@ -1107,7 +1106,7 @@ class BBCode
|
||||||
$text = "[url=" . $match[2] . ']' . $match[2] . "[/url]";
|
$text = "[url=" . $match[2] . ']' . $match[2] . "[/url]";
|
||||||
|
|
||||||
// if its not a picture then look if its a page that contains a picture link
|
// if its not a picture then look if its a page that contains a picture link
|
||||||
$body = HTTPRequest::fetchUrl($match[1]);
|
$body = DI::httpRequest()->fetchUrl($match[1]);
|
||||||
|
|
||||||
$doc = new DOMDocument();
|
$doc = new DOMDocument();
|
||||||
@$doc->loadHTML($body);
|
@$doc->loadHTML($body);
|
||||||
|
@ -1186,7 +1185,7 @@ class BBCode
|
||||||
}
|
}
|
||||||
|
|
||||||
// if its not a picture then look if its a page that contains a picture link
|
// if its not a picture then look if its a page that contains a picture link
|
||||||
$body = HTTPRequest::fetchUrl($match[1]);
|
$body = DI::httpRequest()->fetchUrl($match[1]);
|
||||||
|
|
||||||
$doc = new DOMDocument();
|
$doc = new DOMDocument();
|
||||||
@$doc->loadHTML($body);
|
@$doc->loadHTML($body);
|
||||||
|
|
|
@ -21,8 +21,6 @@
|
||||||
|
|
||||||
namespace Friendica\Core;
|
namespace Friendica\Core;
|
||||||
|
|
||||||
use Friendica\Network\HTTPRequest;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Manage compatibility with federated networks
|
* Manage compatibility with federated networks
|
||||||
*/
|
*/
|
||||||
|
@ -123,7 +121,7 @@ class Protocol
|
||||||
if (preg_match('=https?://(.*)/user/(.*)=ism', $profile_url, $matches)) {
|
if (preg_match('=https?://(.*)/user/(.*)=ism', $profile_url, $matches)) {
|
||||||
$statusnet_host = $matches[1];
|
$statusnet_host = $matches[1];
|
||||||
$statusnet_user = $matches[2];
|
$statusnet_user = $matches[2];
|
||||||
$UserData = HTTPRequest::fetchUrl('http://' . $statusnet_host . '/api/users/show.json?user_id=' . $statusnet_user);
|
$UserData = DI::httpRequest()->fetchUrl('http://' . $statusnet_host . '/api/users/show.json?user_id=' . $statusnet_user);
|
||||||
$user = json_decode($UserData);
|
$user = json_decode($UserData);
|
||||||
if ($user) {
|
if ($user) {
|
||||||
$matches[2] = $user->screen_name;
|
$matches[2] = $user->screen_name;
|
||||||
|
|
|
@ -26,7 +26,6 @@ use Friendica\DI;
|
||||||
use Friendica\Model\Contact;
|
use Friendica\Model\Contact;
|
||||||
use Friendica\Model\GContact;
|
use Friendica\Model\GContact;
|
||||||
use Friendica\Network\HTTPException;
|
use Friendica\Network\HTTPException;
|
||||||
use Friendica\Network\HTTPRequest;
|
|
||||||
use Friendica\Object\Search\ContactResult;
|
use Friendica\Object\Search\ContactResult;
|
||||||
use Friendica\Object\Search\ResultList;
|
use Friendica\Object\Search\ResultList;
|
||||||
use Friendica\Util\Network;
|
use Friendica\Util\Network;
|
||||||
|
@ -124,7 +123,7 @@ class Search
|
||||||
$searchUrl .= '&page=' . $page;
|
$searchUrl .= '&page=' . $page;
|
||||||
}
|
}
|
||||||
|
|
||||||
$resultJson = HTTPRequest::fetchUrl($searchUrl, false, 0, 'application/json');
|
$resultJson = DI::httpRequest()->fetchUrl($searchUrl, false, 0, 'application/json');
|
||||||
|
|
||||||
$results = json_decode($resultJson, true);
|
$results = json_decode($resultJson, true);
|
||||||
|
|
||||||
|
|
|
@ -25,7 +25,6 @@ use Friendica\Core;
|
||||||
use Friendica\Database\DBA;
|
use Friendica\Database\DBA;
|
||||||
use Friendica\DI;
|
use Friendica\DI;
|
||||||
use Friendica\Model\Process;
|
use Friendica\Model\Process;
|
||||||
use Friendica\Network\HTTPRequest;
|
|
||||||
use Friendica\Util\DateTimeFormat;
|
use Friendica\Util\DateTimeFormat;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -997,7 +996,7 @@ class Worker
|
||||||
}
|
}
|
||||||
|
|
||||||
$url = DI::baseUrl() . '/worker';
|
$url = DI::baseUrl() . '/worker';
|
||||||
HTTPRequest::fetchUrl($url, false, 1);
|
DI::httpRequest()->fetchUrl($url, false, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -31,7 +31,6 @@ use Friendica\Core\System;
|
||||||
use Friendica\Core\Worker;
|
use Friendica\Core\Worker;
|
||||||
use Friendica\Database\DBA;
|
use Friendica\Database\DBA;
|
||||||
use Friendica\DI;
|
use Friendica\DI;
|
||||||
use Friendica\Network\HTTPRequest;
|
|
||||||
use Friendica\Network\Probe;
|
use Friendica\Network\Probe;
|
||||||
use Friendica\Protocol\ActivityPub;
|
use Friendica\Protocol\ActivityPub;
|
||||||
use Friendica\Protocol\PortableContact;
|
use Friendica\Protocol\PortableContact;
|
||||||
|
@ -537,7 +536,7 @@ class GContact
|
||||||
$done[] = DI::baseUrl() . '/poco';
|
$done[] = DI::baseUrl() . '/poco';
|
||||||
|
|
||||||
if (strlen(DI::config()->get('system', 'directory'))) {
|
if (strlen(DI::config()->get('system', 'directory'))) {
|
||||||
$x = HTTPRequest::fetchUrl(Search::getGlobalDirectory() . '/pubsites');
|
$x = DI::httpRequest()->fetchUrl(Search::getGlobalDirectory() . '/pubsites');
|
||||||
if (!empty($x)) {
|
if (!empty($x)) {
|
||||||
$j = json_decode($x);
|
$j = json_decode($x);
|
||||||
if (!empty($j->entries)) {
|
if (!empty($j->entries)) {
|
||||||
|
|
|
@ -31,7 +31,6 @@ use Friendica\Database\DBA;
|
||||||
use Friendica\DI;
|
use Friendica\DI;
|
||||||
use Friendica\Module\Register;
|
use Friendica\Module\Register;
|
||||||
use Friendica\Network\CurlResult;
|
use Friendica\Network\CurlResult;
|
||||||
use Friendica\Network\HTTPRequest;
|
|
||||||
use Friendica\Protocol\Diaspora;
|
use Friendica\Protocol\Diaspora;
|
||||||
use Friendica\Protocol\PortableContact;
|
use Friendica\Protocol\PortableContact;
|
||||||
use Friendica\Util\DateTimeFormat;
|
use Friendica\Util\DateTimeFormat;
|
||||||
|
@ -1635,7 +1634,7 @@ class GServer
|
||||||
$protocols = ['activitypub', 'diaspora', 'dfrn', 'ostatus'];
|
$protocols = ['activitypub', 'diaspora', 'dfrn', 'ostatus'];
|
||||||
foreach ($protocols as $protocol) {
|
foreach ($protocols as $protocol) {
|
||||||
$query = '{nodes(protocol:"' . $protocol . '"){host}}';
|
$query = '{nodes(protocol:"' . $protocol . '"){host}}';
|
||||||
$curlResult = HTTPRequest::fetchUrl('https://the-federation.info/graphql?query=' . urlencode($query));
|
$curlResult = DI::httpRequest()->fetchUrl('https://the-federation.info/graphql?query=' . urlencode($query));
|
||||||
if (!empty($curlResult)) {
|
if (!empty($curlResult)) {
|
||||||
$data = json_decode($curlResult, true);
|
$data = json_decode($curlResult, true);
|
||||||
if (!empty($data['data']['nodes'])) {
|
if (!empty($data['data']['nodes'])) {
|
||||||
|
|
|
@ -34,7 +34,6 @@ use Friendica\Database\DBA;
|
||||||
use Friendica\DI;
|
use Friendica\DI;
|
||||||
use Friendica\Model\TwoFactor\AppSpecificPassword;
|
use Friendica\Model\TwoFactor\AppSpecificPassword;
|
||||||
use Friendica\Network\HTTPException\InternalServerErrorException;
|
use Friendica\Network\HTTPException\InternalServerErrorException;
|
||||||
use Friendica\Network\HTTPRequest;
|
|
||||||
use Friendica\Object\Image;
|
use Friendica\Object\Image;
|
||||||
use Friendica\Util\Crypto;
|
use Friendica\Util\Crypto;
|
||||||
use Friendica\Util\DateTimeFormat;
|
use Friendica\Util\DateTimeFormat;
|
||||||
|
@ -824,7 +823,7 @@ class User
|
||||||
$photo_failure = false;
|
$photo_failure = false;
|
||||||
|
|
||||||
$filename = basename($photo);
|
$filename = basename($photo);
|
||||||
$curlResult = HTTPRequest::curl($photo, true);
|
$curlResult = DI::httpRequest()->curl($photo, true);
|
||||||
if ($curlResult->isSuccess()) {
|
if ($curlResult->isSuccess()) {
|
||||||
$img_str = $curlResult->getBody();
|
$img_str = $curlResult->getBody();
|
||||||
$type = $curlResult->getContentType();
|
$type = $curlResult->getContentType();
|
||||||
|
|
|
@ -25,7 +25,6 @@ use Friendica\BaseModule;
|
||||||
use Friendica\Core\Renderer;
|
use Friendica\Core\Renderer;
|
||||||
use Friendica\DI;
|
use Friendica\DI;
|
||||||
use Friendica\Model;
|
use Friendica\Model;
|
||||||
use Friendica\Network\HTTPRequest;
|
|
||||||
use Friendica\Protocol;
|
use Friendica\Protocol;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -49,7 +48,7 @@ class Feed extends BaseModule
|
||||||
|
|
||||||
$contact = Model\Contact::getByURLForUser($url, local_user(), false);
|
$contact = Model\Contact::getByURLForUser($url, local_user(), false);
|
||||||
|
|
||||||
$xml = HTTPRequest::fetchUrl($contact['poll']);
|
$xml = DI::httpRequest()->fetchUrl($contact['poll']);
|
||||||
|
|
||||||
$import_result = Protocol\Feed::import($xml);
|
$import_result = Protocol\Feed::import($xml);
|
||||||
|
|
||||||
|
|
|
@ -341,9 +341,9 @@ class HTTPRequest
|
||||||
* @return string The fetched content
|
* @return string The fetched content
|
||||||
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
|
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
|
||||||
*/
|
*/
|
||||||
public static function fetchUrl(string $url, bool $binary = false, int $timeout = 0, string $accept_content = '', string $cookiejar = '', int &$redirects = 0)
|
public function fetchUrl(string $url, bool $binary = false, int $timeout = 0, string $accept_content = '', string $cookiejar = '', int &$redirects = 0)
|
||||||
{
|
{
|
||||||
$ret = self::fetchUrlFull($url, $binary, $timeout, $accept_content, $cookiejar, $redirects);
|
$ret = $this->fetchUrlFull($url, $binary, $timeout, $accept_content, $cookiejar, $redirects);
|
||||||
|
|
||||||
return $ret->getBody();
|
return $ret->getBody();
|
||||||
}
|
}
|
||||||
|
|
|
@ -41,7 +41,6 @@ use Friendica\Model\Mail;
|
||||||
use Friendica\Model\Post;
|
use Friendica\Model\Post;
|
||||||
use Friendica\Model\Tag;
|
use Friendica\Model\Tag;
|
||||||
use Friendica\Model\User;
|
use Friendica\Model\User;
|
||||||
use Friendica\Network\HTTPRequest;
|
|
||||||
use Friendica\Network\Probe;
|
use Friendica\Network\Probe;
|
||||||
use Friendica\Util\Crypto;
|
use Friendica\Util\Crypto;
|
||||||
use Friendica\Util\DateTimeFormat;
|
use Friendica\Util\DateTimeFormat;
|
||||||
|
@ -1380,7 +1379,7 @@ class Diaspora
|
||||||
|
|
||||||
Logger::log("Fetch post from ".$source_url, Logger::DEBUG);
|
Logger::log("Fetch post from ".$source_url, Logger::DEBUG);
|
||||||
|
|
||||||
$envelope = HTTPRequest::fetchUrl($source_url);
|
$envelope = DI::httpRequest()->fetchUrl($source_url);
|
||||||
if ($envelope) {
|
if ($envelope) {
|
||||||
Logger::log("Envelope was fetched.", Logger::DEBUG);
|
Logger::log("Envelope was fetched.", Logger::DEBUG);
|
||||||
$x = self::verifyMagicEnvelope($envelope);
|
$x = self::verifyMagicEnvelope($envelope);
|
||||||
|
|
|
@ -22,7 +22,6 @@
|
||||||
namespace Friendica\Protocol;
|
namespace Friendica\Protocol;
|
||||||
|
|
||||||
use Friendica\Core\Logger;
|
use Friendica\Core\Logger;
|
||||||
use Friendica\Network\HTTPRequest;
|
|
||||||
use Friendica\Network\Probe;
|
use Friendica\Network\Probe;
|
||||||
use Friendica\Util\Crypto;
|
use Friendica\Util\Crypto;
|
||||||
use Friendica\Util\Strings;
|
use Friendica\Util\Strings;
|
||||||
|
@ -72,7 +71,7 @@ class Salmon
|
||||||
$ret[$x] = substr($ret[$x], 5);
|
$ret[$x] = substr($ret[$x], 5);
|
||||||
}
|
}
|
||||||
} elseif (Strings::normaliseLink($ret[$x]) == 'http://') {
|
} elseif (Strings::normaliseLink($ret[$x]) == 'http://') {
|
||||||
$ret[$x] = HTTPRequest::fetchUrl($ret[$x]);
|
$ret[$x] = DI::httpRequest()->fetchUrl($ret[$x]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -24,7 +24,6 @@ namespace Friendica\Util;
|
||||||
use Friendica\Core\Logger;
|
use Friendica\Core\Logger;
|
||||||
use Friendica\Core\System;
|
use Friendica\Core\System;
|
||||||
use Friendica\DI;
|
use Friendica\DI;
|
||||||
use Friendica\Network\HTTPRequest;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Image utilities
|
* Image utilities
|
||||||
|
@ -185,7 +184,7 @@ class Images
|
||||||
return $data;
|
return $data;
|
||||||
}
|
}
|
||||||
|
|
||||||
$img_str = HTTPRequest::fetchUrl($url, true, 4);
|
$img_str = DI::httpRequest()->fetchUrl($url, true, 4);
|
||||||
|
|
||||||
if (!$img_str) {
|
if (!$img_str) {
|
||||||
return [];
|
return [];
|
||||||
|
|
|
@ -24,7 +24,6 @@ namespace Friendica\Worker;
|
||||||
use Friendica\Core\Logger;
|
use Friendica\Core\Logger;
|
||||||
use Friendica\Database\DBA;
|
use Friendica\Database\DBA;
|
||||||
use Friendica\DI;
|
use Friendica\DI;
|
||||||
use Friendica\Network\HTTPRequest;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Check the git repository VERSION file and save the version to the DB
|
* Check the git repository VERSION file and save the version to the DB
|
||||||
|
@ -55,7 +54,7 @@ class CheckVersion
|
||||||
Logger::log("Checking VERSION from: ".$checked_url, Logger::DEBUG);
|
Logger::log("Checking VERSION from: ".$checked_url, Logger::DEBUG);
|
||||||
|
|
||||||
// fetch the VERSION file
|
// fetch the VERSION file
|
||||||
$gitversion = DBA::escape(trim(HTTPRequest::fetchUrl($checked_url)));
|
$gitversion = DBA::escape(trim(DI::httpRequest()->fetchUrl($checked_url)));
|
||||||
Logger::log("Upstream VERSION is: ".$gitversion, Logger::DEBUG);
|
Logger::log("Upstream VERSION is: ".$gitversion, Logger::DEBUG);
|
||||||
|
|
||||||
DI::config()->set('system', 'git_friendica_version', $gitversion);
|
DI::config()->set('system', 'git_friendica_version', $gitversion);
|
||||||
|
|
|
@ -33,7 +33,6 @@ use Friendica\Model\GContact;
|
||||||
use Friendica\Model\Nodeinfo;
|
use Friendica\Model\Nodeinfo;
|
||||||
use Friendica\Model\Photo;
|
use Friendica\Model\Photo;
|
||||||
use Friendica\Model\User;
|
use Friendica\Model\User;
|
||||||
use Friendica\Network\HTTPRequest;
|
|
||||||
use Friendica\Util\Proxy as ProxyUtils;
|
use Friendica\Util\Proxy as ProxyUtils;
|
||||||
use Friendica\Util\Strings;
|
use Friendica\Util\Strings;
|
||||||
|
|
||||||
|
@ -61,7 +60,7 @@ class CronJobs
|
||||||
// Now trying to register
|
// Now trying to register
|
||||||
$url = 'http://the-federation.info/register/' . DI::baseUrl()->getHostname();
|
$url = 'http://the-federation.info/register/' . DI::baseUrl()->getHostname();
|
||||||
Logger::debug('Check registering url', ['url' => $url]);
|
Logger::debug('Check registering url', ['url' => $url]);
|
||||||
$ret = HTTPRequest::fetchUrl($url);
|
$ret = DI::httpRequest()->fetchUrl($url);
|
||||||
Logger::debug('Check registering answer', ['answer' => $ret]);
|
Logger::debug('Check registering answer', ['answer' => $ret]);
|
||||||
Logger::info('cron_end');
|
Logger::info('cron_end');
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -26,7 +26,6 @@ use Friendica\Core\Logger;
|
||||||
use Friendica\Core\Worker;
|
use Friendica\Core\Worker;
|
||||||
use Friendica\Database\DBA;
|
use Friendica\Database\DBA;
|
||||||
use Friendica\DI;
|
use Friendica\DI;
|
||||||
use Friendica\Network\HTTPRequest;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sends updated profile data to the directory
|
* Sends updated profile data to the directory
|
||||||
|
@ -54,7 +53,7 @@ class Directory
|
||||||
|
|
||||||
Logger::log('Updating directory: ' . $arr['url'], Logger::DEBUG);
|
Logger::log('Updating directory: ' . $arr['url'], Logger::DEBUG);
|
||||||
if (strlen($arr['url'])) {
|
if (strlen($arr['url'])) {
|
||||||
HTTPRequest::fetchUrl($dir . '?url=' . bin2hex($arr['url']));
|
DI::httpRequest()->fetchUrl($dir . '?url=' . bin2hex($arr['url']));
|
||||||
}
|
}
|
||||||
|
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -30,7 +30,6 @@ use Friendica\DI;
|
||||||
use Friendica\Model\Contact;
|
use Friendica\Model\Contact;
|
||||||
use Friendica\Model\GContact;
|
use Friendica\Model\GContact;
|
||||||
use Friendica\Model\GServer;
|
use Friendica\Model\GServer;
|
||||||
use Friendica\Network\HTTPRequest;
|
|
||||||
use Friendica\Util\Strings;
|
use Friendica\Util\Strings;
|
||||||
|
|
||||||
class SearchDirectory
|
class SearchDirectory
|
||||||
|
@ -52,7 +51,7 @@ class SearchDirectory
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$x = HTTPRequest::fetchUrl(Search::getGlobalDirectory() . '/lsearch?p=1&n=500&search=' . urlencode($search));
|
$x = DI::httpRequest()->fetchUrl(Search::getGlobalDirectory() . '/lsearch?p=1&n=500&search=' . urlencode($search));
|
||||||
$j = json_decode($x);
|
$j = json_decode($x);
|
||||||
|
|
||||||
if (!empty($j->results)) {
|
if (!empty($j->results)) {
|
||||||
|
|
Loading…
Reference in a new issue