Merge pull request #16572 from civicrm/5.23
[civicrm-core.git] / CRM / Extension / Downloader.php
index f06fba6e8a31e27645560c51a2999ea01bca34e8..cc43c8be6ee4c0efa0ff193f3f95cf8b0361ff53 100644 (file)
  */
 class CRM_Extension_Downloader {
   /**
-   * @var CRM_Extension_Container_Basic the place where downloaded extensions are ultimately stored
+   * @var CRM_Extension_Container_Basic
+   * The place where downloaded extensions are ultimately stored
    */
   public $container;
 
   /**
-   * @var string local path to a temporary data directory
+   * @var string
+   * Local path to a temporary data directory
    */
   public $tmpDir;
 
@@ -71,7 +73,7 @@ class CRM_Extension_Downloader {
 
     if (empty($errors) && !CRM_Utils_HttpClient::singleton()->isRedirectSupported()) {
       CRM_Core_Session::setStatus(ts('WARNING: The downloader may be unable to download files which require HTTP redirection. This may be a configuration issue with PHP\'s open_basedir or safe_mode.'));
-      CRM_Core_Error::debug_log_message('WARNING: The downloader may be unable to download files which require HTTP redirection. This may be a configuration issue with PHP\'s open_basedir or safe_mode.');
+      Civi::log()->debug('WARNING: The downloader may be unable to download files which require HTTP redirection. This may be a configuration issue with PHP\'s open_basedir or safe_mode.');
     }
 
     if ($extensionInfo) {
@@ -105,7 +107,7 @@ class CRM_Extension_Downloader {
     $destDir = $this->containerDir . DIRECTORY_SEPARATOR . $key;
 
     if (!$downloadUrl) {
-      CRM_Core_Error::fatal(ts('Cannot install this extension - downloadUrl is not set!'));
+      throw new CRM_Extension_Exception(ts('Cannot install this extension - downloadUrl is not set!'));
     }
 
     if (!$this->fetch($downloadUrl, $filename)) {
@@ -196,6 +198,7 @@ class CRM_Extension_Downloader {
    * @param $extractedZipPath
    *
    * @return bool
+   * @throws CRM_Core_Exception
    */
   public function validateFiles($key, $extractedZipPath) {
     $filename = $extractedZipPath . DIRECTORY_SEPARATOR . CRM_Extension_Info::FILENAME;
@@ -213,7 +216,7 @@ class CRM_Extension_Downloader {
     }
 
     if ($newInfo->key != $key) {
-      CRM_Core_Error::fatal(ts('Cannot install - there are differences between extdir XML file and archive XML file!'));
+      throw new CRM_Core_Exception(ts('Cannot install - there are differences between extdir XML file and archive XML file!'));
     }
 
     return TRUE;