From 708875ab329eca4537d47441571b46762d36393c Mon Sep 17 00:00:00 2001 From: "Moritz Schubotz (physikerwelt)" Date: Fri, 2 Feb 2018 16:37:00 +0100 Subject: [PATCH] Throw exception if php-curl is missing Currently MediaWiki just dies silently, if the php curl extension is missing. Throw an exception instead that redirects the admin to the appropriate help page. Change-Id: I25edfcb34ee5451a742cac6ae099019a16f6c417 --- includes/libs/MultiHttpClient.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/includes/libs/MultiHttpClient.php b/includes/libs/MultiHttpClient.php index 16168e6b59..3282ae2054 100644 --- a/includes/libs/MultiHttpClient.php +++ b/includes/libs/MultiHttpClient.php @@ -421,9 +421,14 @@ class MultiHttpClient implements LoggerAwareInterface { /** * @return resource + * @throws Exception */ protected function getCurlMulti() { if ( !$this->multiHandle ) { + if ( !function_exists( 'curl_multi_init' ) ) { + throw new Exception( "PHP cURL extension missing. " . + "Check https://www.mediawiki.org/wiki/Manual:CURL" ); + } $cmh = curl_multi_init(); curl_multi_setopt( $cmh, CURLMOPT_PIPELINING, (int)$this->usePipelining ); curl_multi_setopt( $cmh, CURLMOPT_MAXCONNECTS, (int)$this->maxConnsPerHost ); -- 2.20.1