Manybubbles has uploaded a new change for review. https://gerrit.wikimedia.org/r/95541
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. Bug: 57024 Change-Id: If45aa7309e7a876fa5098a8c9e47450ef9d18f9d --- M CirrusSearch.i18n.php M CirrusSearch.php M includes/CirrusSearch.body.php 3 files changed, 16 insertions(+), 0 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/CirrusSearch refs/changes/41/95541/1 diff --git a/CirrusSearch.i18n.php b/CirrusSearch.i18n.php index a1d928d..1619257 100644 --- a/CirrusSearch.i18n.php +++ b/CirrusSearch.i18n.php @@ -12,6 +12,8 @@ $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 now using CirrusSearch, MediaWiki\'s new search engine. +([[mw:Special:MyLanguage/Help:CirrusSearch|Learn more about CirrusSearch]])', '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: newchange Gerrit-Change-Id: If45aa7309e7a876fa5098a8c9e47450ef9d18f9d Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/CirrusSearch Gerrit-Branch: master Gerrit-Owner: Manybubbles <never...@wikimedia.org> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits