Nemo bis has uploaded a new change for review. https://gerrit.wikimedia.org/r/239037
Change subject: Do not output interwiki search results box when there's no result ...................................................................... Do not output interwiki search results box when there's no result Check again if we were passed any match from the search. Bug: T96881 Change-Id: Ifc61cf1563834bafa726d4f975fb93bd93f40cf2 --- M includes/search/SearchResultSet.php M includes/specials/SpecialSearch.php 2 files changed, 9 insertions(+), 5 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core refs/changes/37/239037/1 diff --git a/includes/search/SearchResultSet.php b/includes/search/SearchResultSet.php index 8d18b0e..f54bfb1 100644 --- a/includes/search/SearchResultSet.php +++ b/includes/search/SearchResultSet.php @@ -114,7 +114,7 @@ /** * Return a result set of hits on other (multiple) wikis associated with this one * - * @return SearchResultSet + * @return SearchResultSet, null if none */ function getInterwikiResults() { return null; diff --git a/includes/specials/SpecialSearch.php b/includes/specials/SpecialSearch.php index 6606c7f..fd3c744 100644 --- a/includes/specials/SpecialSearch.php +++ b/includes/specials/SpecialSearch.php @@ -827,6 +827,14 @@ protected function showInterwiki( $matches, $query ) { global $wgContLang; + if ( !is_array( $matches ) ) { + $matches = array( $matches ); + } + if ( empty( $matches ) ) { + # Something went wrong with hasInterwikiResults() earlier. + return ''; + } + $out = "<div id='mw-search-interwiki'><div id='mw-search-interwiki-caption'>" . $this->msg( 'search-interwiki-caption' )->text() . "</div>\n"; $out .= "<ul class='mw-search-iwresults'>\n"; @@ -840,10 +848,6 @@ if ( count( $parts ) == 2 ) { // validate line $customCaptions[$parts[0]] = $parts[1]; } - } - - if ( !is_array( $matches ) ) { - $matches = array( $matches ); } foreach ( $matches as $set ) { -- To view, visit https://gerrit.wikimedia.org/r/239037 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Ifc61cf1563834bafa726d4f975fb93bd93f40cf2 Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/core Gerrit-Branch: master Gerrit-Owner: Nemo bis <federicol...@tiscali.it> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits