jenkins-bot has submitted this change and it was merged.
Change subject: Show notification on search page if configured
......................................................................
Show notification on search page if configured
If $wgCirrusSearchShowNowUsing is true then show a note about this wiki
now using CirrusSearch. $wgCirrusSearchShowNowUsing defaults to false.
The message's phrasing is consistent with similar phrasing in the OAuth
extension.
Bug: 57024
Change-Id: If45aa7309e7a876fa5098a8c9e47450ef9d18f9d
---
M CirrusSearch.i18n.php
M CirrusSearch.php
M includes/CirrusSearch.body.php
3 files changed, 15 insertions(+), 0 deletions(-)
Approvals:
Chad: Looks good to me, approved
jenkins-bot: Verified
diff --git a/CirrusSearch.i18n.php b/CirrusSearch.i18n.php
index a1d928d..73e05cb 100644
--- a/CirrusSearch.i18n.php
+++ b/CirrusSearch.i18n.php
@@ -12,6 +12,7 @@
$messages['en'] = array(
'cirrussearch-desc' => 'Elasticsearch-powered search for MediaWiki',
'cirrussearch-backend-error' => 'We could not complete your search due
to a temporary problem. Please try again later.',
+ 'cirrussearch-now-using' => 'This wiki is using a new search engine.
([[mw:Special:MyLanguage/Help:CirrusSearch|Learn more]])',
'cirrussearch-ignored-headings' => ' #<!-- leave this line exactly as
it is --> <pre>
# Headings that will be ignored by search.
# Changes to this take effect as soon as the page with the heading is indexed.
diff --git a/CirrusSearch.php b/CirrusSearch.php
index ef60ca1..800942a 100644
--- a/CirrusSearch.php
+++ b/CirrusSearch.php
@@ -123,6 +123,9 @@
// Changing it requires an in place reindex to take effect. Currently only
available in English.
$wgCirrusSearchUseAggressiveSplitting = true;
+// Show the notification about this wiki using CirrusSearch on the search page.
+$wgCirrusSearchShowNowUsing = false;
+
$includes = __DIR__ . "/includes/";
/**
* Classes
@@ -148,6 +151,7 @@
*/
$wgHooks[ 'LinksUpdateComplete' ][] =
'CirrusSearchUpdater::linksUpdateCompletedHook';
$wgHooks[ 'SoftwareInfo' ][] = 'CirrusSearch::softwareInfoHook';
+$wgHooks[ 'SpecialSearchResultsPrepend' ][] =
'CirrusSearch::specialSearchResultsPrependHook';
// Install our prefix search hook only if we're enabled.
$wgExtensionFunctions[] = function() {
global $wgSearchType, $wgHooks;
diff --git a/includes/CirrusSearch.body.php b/includes/CirrusSearch.body.php
index 5a312e8..d5f0611 100644
--- a/includes/CirrusSearch.body.php
+++ b/includes/CirrusSearch.body.php
@@ -125,4 +125,14 @@
$software[ '[http://www.elasticsearch.org/
Elasticsearch]' ] = $version->getValue();
}
}
+
+ public static function specialSearchResultsPrependHook( $specialSearch,
$out, $term ) {
+ global $wgCirrusSearchShowNowUsing;
+ if ( $wgCirrusSearchShowNowUsing ) {
+ $out->addHtml( Xml::openElement( 'div', array( 'class'
=> 'cirrussearch-now-using' ) ) .
+ $specialSearch->msg( 'cirrussearch-now-using'
)->parse() .
+ Xml::closeElement( 'div' ) );
+ }
+ return true;
+ }
}
--
To view, visit https://gerrit.wikimedia.org/r/95541
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: If45aa7309e7a876fa5098a8c9e47450ef9d18f9d
Gerrit-PatchSet: 3
Gerrit-Project: mediawiki/extensions/CirrusSearch
Gerrit-Branch: master
Gerrit-Owner: Manybubbles <[email protected]>
Gerrit-Reviewer: Chad <[email protected]>
Gerrit-Reviewer: Deskana <[email protected]>
Gerrit-Reviewer: MZMcBride <[email protected]>
Gerrit-Reviewer: Manybubbles <[email protected]>
Gerrit-Reviewer: Nemo bis <[email protected]>
Gerrit-Reviewer: jenkins-bot
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits