jenkins-bot has submitted this change and it was merged. (
https://gerrit.wikimedia.org/r/398773 )
Change subject: Fail gracefully if curl is not installed
......................................................................
Fail gracefully if curl is not installed
Bug: T166355
Change-Id: Iaf4864dc76535efc3ccd09efe1b6c4f9178130c4
---
M CirrusSearch.php
M includes/Hooks.php
2 files changed, 29 insertions(+), 0 deletions(-)
Approvals:
Cindy-the-browser-test-bot: Looks good to me, but someone else must approve
Florianschmidtwelzow: Looks good to me, approved
jenkins-bot: Verified
diff --git a/CirrusSearch.php b/CirrusSearch.php
index a2d3461..2a9fd4f 100644
--- a/CirrusSearch.php
+++ b/CirrusSearch.php
@@ -1280,6 +1280,11 @@
}
/**
+ * Check if curl is installed
+ */
+$wgExtensionFunctions[] = 'CirrusSearch\Hooks::checkCurlInstallation';
+
+/**
* Hooks
*/
$wgHooks[ 'CirrusSearchBuildDocumentFinishBatch'][] =
'CirrusSearch\BuildDocument\RedirectsAndIncomingLinks::finishBatch';
diff --git a/includes/Hooks.php b/includes/Hooks.php
index 63a1766..a38f67c 100644
--- a/includes/Hooks.php
+++ b/includes/Hooks.php
@@ -865,4 +865,28 @@
$extraStats['cirrussearch-article-words'] = $wordCount;
}
}
+
+ /**
+ * Check if cURL PHP extension is installed
+ */
+ public static function checkCurlInstallation() {
+ if ( function_exists( 'curl_version' ) ) {
+ return;
+ }
+
+ $phpVersionCheck = new \PHPVersionCheck();
+ $errorMessageLong = 'The CirrusSearch extension requires the
<b>cURL</b> PHP extension to operate,'
+ . ' but it is not installed on this
server.';
+ $phpVersionCheck->triggerError(
+ 'Required dependency for CirrusSearch is missing',
+ $phpVersionCheck->getIndexErrorOutput(
+ 'Required dependency for CirrusSearch is
missing',
+ $errorMessageLong . ' Please install the
<b>cURL</b> PHP extension.',
+ 'cURL PHP extension is not installed'
+ ),
+ $errorMessageLong,
+ $errorMessageLong
+ );
+ }
+
}
--
To view, visit https://gerrit.wikimedia.org/r/398773
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: Iaf4864dc76535efc3ccd09efe1b6c4f9178130c4
Gerrit-PatchSet: 8
Gerrit-Project: mediawiki/extensions/CirrusSearch
Gerrit-Branch: master
Gerrit-Owner: Phantom42 <[email protected]>
Gerrit-Reviewer: Cindy-the-browser-test-bot <[email protected]>
Gerrit-Reviewer: DCausse <[email protected]>
Gerrit-Reviewer: EBernhardson <[email protected]>
Gerrit-Reviewer: Florianschmidtwelzow <[email protected]>
Gerrit-Reviewer: Gehel <[email protected]>
Gerrit-Reviewer: Phantom42 <[email protected]>
Gerrit-Reviewer: Reedy <[email protected]>
Gerrit-Reviewer: Smalyshev <[email protected]>
Gerrit-Reviewer: jenkins-bot <>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits