Skip to content
Snippets Groups Projects
Commit eb066397 authored by totten's avatar totten
Browse files

CRM-14126 - CRM_Extension - Add pleasant warning and log message if...

CRM-14126 - CRM_Extension - Add pleasant warning and log message if open_basedir/safe_mode prevents redirects.

----------------------------------------
 * CRM-14126: HttpClient.php library used by CiviCRM issues a PHP warning when open_basedir is set
   http://issues.civicrm.org/jira/browse/CRM-14126
parent 439b9688
No related branches found
No related tags found
No related merge requests found
......@@ -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;
}
......
......@@ -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';
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment