From 4464e7c2056d127ef1588845560e17ac17ff2369 Mon Sep 17 00:00:00 2001 From: Bradley Taylor Date: Thu, 1 Sep 2022 18:59:08 +0100 Subject: [PATCH] Update CRM_Extension_Downloader to not use dynamic properties --- CRM/Extension/Downloader.php | 43 ++++++++++++++++++++++-------------- 1 file changed, 26 insertions(+), 17 deletions(-) diff --git a/CRM/Extension/Downloader.php b/CRM/Extension/Downloader.php index 4b472267af..d17ea3025d 100644 --- a/CRM/Extension/Downloader.php +++ b/CRM/Extension/Downloader.php @@ -18,35 +18,31 @@ class CRM_Extension_Downloader { /** - * @var GuzzleHttp\Client + * @var CRM_Extension_Manager */ - protected $guzzleClient; + private $manager; /** - * @return \GuzzleHttp\Client + * @var string */ - public function getGuzzleClient(): \GuzzleHttp\Client { - return $this->guzzleClient ?? new \GuzzleHttp\Client(); - } + private $containerDir; /** - * @param \GuzzleHttp\Client $guzzleClient + * @var string + * Local path to a temporary data directory */ - public function setGuzzleClient(\GuzzleHttp\Client $guzzleClient) { - $this->guzzleClient = $guzzleClient; - } + public $tmpDir; /** - * @var CRM_Extension_Container_Basic - * The place where downloaded extensions are ultimately stored + * @var GuzzleHttp\Client */ - public $container; + protected $guzzleClient; /** - * @var string - * Local path to a temporary data directory + * @var CRM_Extension_Container_Basic + * The place where downloaded extensions are ultimately stored */ - public $tmpDir; + public $container; /** * @param CRM_Extension_Manager $manager @@ -60,6 +56,20 @@ class CRM_Extension_Downloader { $this->tmpDir = $tmpDir; } + /** + * @return \GuzzleHttp\Client + */ + public function getGuzzleClient(): \GuzzleHttp\Client { + return $this->guzzleClient ?? new \GuzzleHttp\Client(); + } + + /** + * @param \GuzzleHttp\Client $guzzleClient + */ + public function setGuzzleClient(\GuzzleHttp\Client $guzzleClient) { + $this->guzzleClient = $guzzleClient; + } + /** * Determine whether downloading is supported. * @@ -121,7 +131,6 @@ class CRM_Extension_Downloader { */ public function download($key, $downloadUrl) { $filename = $this->tmpDir . DIRECTORY_SEPARATOR . $key . '.zip'; - $destDir = $this->containerDir . DIRECTORY_SEPARATOR . $key; if (!$downloadUrl) { throw new CRM_Extension_Exception(ts('Cannot install this extension - downloadUrl is not set!')); -- 2.25.1