Merge "Don't use rclimit preference on Special:Search"
authorjenkins-bot <jenkins-bot@gerrit.wikimedia.org>
Wed, 2 Jul 2014 22:18:04 +0000 (22:18 +0000)
committerGerrit Code Review <gerrit@wikimedia.org>
Wed, 2 Jul 2014 22:18:04 +0000 (22:18 +0000)
1  2 
includes/specials/SpecialSearch.php

@@@ -114,7 -114,7 +114,7 @@@ class SpecialSearch extends SpecialPag
         */
        public function load() {
                $request = $this->getRequest();
-               list( $this->limit, $this->offset ) = $request->getLimitOffset( 20 );
+               list( $this->limit, $this->offset ) = $request->getLimitOffset( 20, '' );
                $this->mPrefix = $request->getVal( 'prefix', '' );
  
                $user = $this->getUser();
  
                $profile = new ProfileSection( __METHOD__ );
                $search = $this->getSearchEngine();
 -              // Request an extra result to determine whether a "next page" link is useful
 -              $search->setLimitOffset( $this->limit + 1, $this->offset );
 +              $search->setLimitOffset( $this->limit, $this->offset );
                $search->setNamespaces( $this->namespaces );
                $this->saveNamespaces();
                $search->prefix = $this->mPrefix;
                                        $this->offset,
                                        $this->limit,
                                        $this->powerSearchOptions() + array( 'search' => $term ),
 -                                      max( $titleMatchesNum, $textMatchesNum ) <= $this->limit
 +                                      $this->limit + $this->offset >= $totalRes
                                );
                        }
                        wfRunHooks( 'SpecialSearchResults', array( $term, &$titleMatches, &$textMatches ) );
  
                if ( $user->isLoggedIn() &&
                        !is_null( $request->getVal( 'nsRemember' ) ) &&
 -                      $user->matchEditToken( $request->getVal( 'nsToken' ) )
 +                      $user->matchEditToken(
 +                              $request->getVal( 'nsToken' ),
 +                              'searchnamespace',
 +                              $request
 +                      )
                ) {
                        // Reset namespace preferences: namespaces are not searched
                        // when they're not mentioned in the URL parameters.
  
                $out = "<ul class='mw-search-results'>\n";
                $result = $matches->next();
 -              $count = 0;
 -              while ( $result && $count < $this->limit ) {
 +              while ( $result ) {
                        $out .= $this->showHit( $result, $terms );
                        $result = $matches->next();
 -                      $count++;
                }
                $out .= "</ul>\n";
  
                $remember = '';
                $user = $this->getUser();
                if ( $user->isLoggedIn() ) {
 -                      $remember .= Html::hidden( 'nsToken', $user->getEditToken() ) .
 +                      $remember .= Html::hidden(
 +                              'nsToken',
 +                              $user->getEditToken(
 +                                      'searchnamespace',
 +                                      $this->getRequest()
 +                              )
 +                      ) .
                        Xml::checkLabel(
                                wfMessage( 'powersearch-remember' )->text(),
                                'nsRemember',