From 37bab4a45afd4993a570f18e1fae06346b42d976 Mon Sep 17 00:00:00 2001 From: Jack Phoenix Date: Wed, 29 Apr 2015 03:16:38 +0300 Subject: [PATCH] Allow QueryPage subclasses to use a different "no results" message than "specialpage-empty" Child classes wishing to show a different message, such as wikiHow's NewArticleBoost extension, need to override showEmptyText() to display their custom message via the appropriate OutputPage method(s). Change-Id: If488e2c81b225eb651e52bcca0fea08b8e685286 --- includes/specialpage/QueryPage.php | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/includes/specialpage/QueryPage.php b/includes/specialpage/QueryPage.php index da752f6a1c..92409cd652 100644 --- a/includes/specialpage/QueryPage.php +++ b/includes/specialpage/QueryPage.php @@ -252,6 +252,17 @@ abstract class QueryPage extends SpecialPage { return ''; } + /** + * Outputs some kind of an informative message (via OutputPage) to let the + * user know that the query returned nothing and thus there's nothing to + * show. + * + * @since 1.26 + */ + protected function showEmptyText() { + $this->getOutput()->addWikiMsg( 'specialpage-empty' ); + } + /** * If using extra form wheely-dealies, return a set of parameters here * as an associative array. They will be encoded and added to the paging @@ -546,7 +557,7 @@ abstract class QueryPage extends SpecialPage { } else { # No results to show, so don't bother with "showing X of Y" etc. # -- just let the user know and give up now - $out->addWikiMsg( 'specialpage-empty' ); + $this->showEmptyText(); $out->addHTML( Xml::closeElement( 'div' ) ); return; } -- 2.20.1