Merge pull request #17528 from seamuslee001/nfv_apiv3_mem_type_apiv4_test
[civicrm-core.git] / CRM / Utils / HttpClient.php
index 4bab3001ea565638be82887c02c136c0a83d97ab..c2d12ae18cffc677d923bd78b7b1c62a78147289 100644 (file)
@@ -62,16 +62,18 @@ class CRM_Utils_HttpClient {
    * @param string $localFile
    *   Path at which to store the .zip file.
    * @return STATUS_OK|STATUS_WRITE_ERROR|STATUS_DL_ERROR
+   *
+   * @throws CRM_Core_Exception
    */
   public function fetch($remoteFile, $localFile) {
     // Download extension zip file ...
     if (!function_exists('curl_init')) {
-      CRM_Core_Error::fatal('Cannot install this extension - curl is not installed!');
+      throw new CRM_Core_Exception('Cannot install this extension - curl is not installed!');
     }
 
     list($ch, $caConfig) = $this->createCurl($remoteFile);
     if (preg_match('/^https:/', $remoteFile) && !$caConfig->isEnableSSL()) {
-      CRM_Core_Error::fatal('Cannot install this extension - does not support SSL');
+      throw new CRM_Core_Exception('Cannot install this extension - does not support SSL');
     }
 
     $fp = @fopen($localFile, "w");
@@ -115,7 +117,6 @@ class CRM_Utils_HttpClient {
     list($ch, $caConfig) = $this->createCurl($remoteFile);
 
     if (preg_match('/^https:/', $remoteFile) && !$caConfig->isEnableSSL()) {
-      // CRM_Core_Error::fatal('Cannot install this extension - does not support SSL');
       return [self::STATUS_DL_ERROR, NULL];
     }
 
@@ -144,14 +145,12 @@ class CRM_Utils_HttpClient {
   public function post($remoteFile, $params) {
     // Download extension zip file ...
     if (!function_exists('curl_init')) {
-      //CRM_Core_Error::fatal('Cannot install this extension - curl is not installed!');
       return [self::STATUS_DL_ERROR, NULL];
     }
 
     list($ch, $caConfig) = $this->createCurl($remoteFile);
 
     if (preg_match('/^https:/', $remoteFile) && !$caConfig->isEnableSSL()) {
-      // CRM_Core_Error::fatal('Cannot install this extension - does not support SSL');
       return [self::STATUS_DL_ERROR, NULL];
     }