diff options
author | Thomas Müller <thomas.mueller@tmit.eu> | 2016-04-18 17:28:10 +0200 |
---|---|---|
committer | Thomas Müller <thomas.mueller@tmit.eu> | 2016-04-18 17:28:10 +0200 |
commit | 1626850fc98d619e502eb114d5f26baf06c1e183 (patch) | |
tree | f09987520080ec232019d54e22685f58abac87e3 /lib/private | |
parent | 5c3183cedd9672025199a1298853834df1c1320f (diff) | |
download | nextcloud-server-1626850fc98d619e502eb114d5f26baf06c1e183.tar.gz nextcloud-server-1626850fc98d619e502eb114d5f26baf06c1e183.zip |
Remove deprecated HTTPHelper
Diffstat (limited to 'lib/private')
-rw-r--r-- | lib/private/updater/versioncheck.php | 30 |
1 files changed, 22 insertions, 8 deletions
diff --git a/lib/private/updater/versioncheck.php b/lib/private/updater/versioncheck.php index 2c93952fed6..e42a1e2a40c 100644 --- a/lib/private/updater/versioncheck.php +++ b/lib/private/updater/versioncheck.php @@ -33,28 +33,27 @@ namespace OC\Updater; -use OC\Hooks\BasicEmitter; -use OC\HTTPHelper; use OC_Util; +use OCP\Http\Client\IClientService; use OCP\IConfig; use OC\Setup; use OCP\Util; class VersionCheck { - /** @var \OC\HTTPHelper $helper */ - private $httpHelper; + /** @var IClientService */ + private $clientService; /** @var IConfig */ private $config; /** - * @param HTTPHelper $httpHelper + * @param IClientService $clientService * @param IConfig $config */ - public function __construct(HTTPHelper $httpHelper, + public function __construct(IClientService $clientService, IConfig $config) { - $this->httpHelper = $httpHelper; + $this->clientService = $clientService; $this->config = $config; } @@ -94,7 +93,7 @@ class VersionCheck { $url = $updaterUrl . '?version=' . $versionString; $tmp = []; - $xml = $this->httpHelper->getUrlContent($url); + $xml = $this->getUrlContent($url); if ($xml) { $loadEntities = libxml_disable_entity_loader(true); $data = @simplexml_load_string($xml); @@ -115,5 +114,20 @@ class VersionCheck { $this->config->setAppValue('core', 'lastupdateResult', json_encode($data)); return $tmp; } + + /** + * @codeCoverageIgnore + * @param string $url + * @return bool|resource|string + */ + protected function getUrlContent($url) { + try { + $client = $this->clientService->newClient(); + $response = $client->get($url); + return $response->getBody(); + } catch (\Exception $e) { + return false; + } + } } |