From 6cda8fd1f782b2a6cdfa0538b618ce060092c0cd Mon Sep 17 00:00:00 2001 From: Matthew Wire Date: Wed, 11 Aug 2021 17:11:57 +0100 Subject: [PATCH] Switch extension downloader to use Guzzle. --- CRM/Extension/Downloader.php | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/CRM/Extension/Downloader.php b/CRM/Extension/Downloader.php index db85f4248c..c1c31c604d 100644 --- a/CRM/Extension/Downloader.php +++ b/CRM/Extension/Downloader.php @@ -136,14 +136,12 @@ class CRM_Extension_Downloader { * Whether the download was successful. */ public function fetch($remoteFile, $localFile) { - $result = CRM_Utils_HttpClient::singleton()->fetch($remoteFile, $localFile); - switch ($result) { - case CRM_Utils_HttpClient::STATUS_OK: - return TRUE; - - default: - return FALSE; + $client = new GuzzleHttp\Client(); + $response = $client->request('GET', $remoteFile, ['sink' => $localFile, 'timeout' => \Civi::settings()->get('http_timeout')]); + if ($response->getStatusCode() === 200) { + return TRUE; } + return FALSE; } /** -- 2.25.1