From 8c23482db824c9a14d416729adef4fb27d16f181 Mon Sep 17 00:00:00 2001 From: Chad Horohoe Date: Wed, 30 Apr 2014 16:16:02 -0700 Subject: [PATCH] Don't bother showing prev/next links navigation when there's few results Started working on bug 48466 bug we'll need a new message for viewprevnext that doesn't have parens when there's no need. Saw this along the way and it was easier. Change-Id: If3d3503a1b7ebd6c8adad42725f53314733e72cf --- includes/specials/SpecialSearch.php | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/includes/specials/SpecialSearch.php b/includes/specials/SpecialSearch.php index 0c4252e497..6eee861fff 100644 --- a/includes/specials/SpecialSearch.php +++ b/includes/specials/SpecialSearch.php @@ -360,14 +360,16 @@ class SpecialSearch extends SpecialPage { $out->addHtml( "
" ); // prev/next links + $prevnext = null; if ( $num || $this->offset ) { // Show the create link ahead $this->showCreateLink( $title, $num, $titleMatches, $textMatches ); - $prevnext = $this->getLanguage()->viewPrevNext( $this->getPageTitle(), $this->offset, $this->limit, - $this->powerSearchOptions() + array( 'search' => $term ), - max( $titleMatchesNum, $textMatchesNum ) < $this->limit - ); - //$out->addHTML( "

{$prevnext}

\n" ); + if ( $totalRes > $this->limit || $this->offset ) { + $prevnext = $this->getLanguage()->viewPrevNext( $this->getPageTitle(), $this->offset, $this->limit, + $this->powerSearchOptions() + array( 'search' => $term ), + max( $titleMatchesNum, $textMatchesNum ) < $this->limit + ); + } wfRunHooks( 'SpecialSearchResults', array( $term, &$titleMatches, &$textMatches ) ); } else { wfRunHooks( 'SpecialSearchNoResults', array( $term ) ); @@ -386,10 +388,8 @@ class SpecialSearch extends SpecialPage { if ( $numTextMatches > 0 && $numTitleMatches > 0 ) { // if no title matches the heading is redundant $out->wrapWikiMsg( "==$1==\n", 'textmatches' ); - } elseif ( $totalRes == 0 ) { - # Don't show the 'no text matches' if we received title matches - # $out->wrapWikiMsg( "==$1==\n", 'notextmatches' ); } + // show interwiki results if any if ( $textMatches->hasInterwikiResults() ) { $out->addHTML( $this->showInterwiki( $textMatches->getInterwikiResults(), $term ) ); @@ -413,7 +413,7 @@ class SpecialSearch extends SpecialPage { } $out->addHtml( "
" ); - if ( $num || $this->offset ) { + if ( $prevnext ) { $out->addHTML( "

{$prevnext}

\n" ); } } -- 2.20.1