diff --git a/CRM/Extension/Downloader.php b/CRM/Extension/Downloader.php index 3c40f0bc30af6ed2218646ec15f3dafbdba338da..4a6274efc5227e9031e1d3125f96cc0a80c8be15 100644 --- a/CRM/Extension/Downloader.php +++ b/CRM/Extension/Downloader.php @@ -84,6 +84,11 @@ 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.'); + } + return $errors; } diff --git a/CRM/Utils/HttpClient.php b/CRM/Utils/HttpClient.php index c94b605fd9445f260a5e8962c50a593b6fcb945f..d7c5422fc7030d726082f7db59c67555d4ca7e61 100644 --- a/CRM/Utils/HttpClient.php +++ b/CRM/Utils/HttpClient.php @@ -189,7 +189,7 @@ class CRM_Utils_HttpClient { curl_setopt($ch, CURLOPT_HEADER, FALSE); curl_setopt($ch, CURLOPT_ENCODING, 'gzip'); curl_setopt($ch, CURLOPT_VERBOSE, 0); - if (ini_get('open_basedir') == '' && ini_get('safe_mode') == 'Off') { + if ($this->isRedirectSupported()) { curl_setopt($ch, CURLOPT_FOLLOWLOCATION, TRUE); } if ($this->connectionTimeout !== NULL) { @@ -202,4 +202,8 @@ class CRM_Utils_HttpClient { return array($ch, $caConfig); } + public function isRedirectSupported() { + return ini_get('open_basedir') == '' && ini_get('safe_mode') == 'Off'; + } + }