From: Sam Reed Date: Thu, 6 Jan 2011 00:31:23 +0000 (+0000) Subject: Minor followup to r79649. Rename variables X-Git-Tag: 1.31.0-rc.0~32780 X-Git-Url: http://git.cyclocoop.org//%27%40script%40/%27?a=commitdiff_plain;h=7ea350c3eb0464d351f0309402aa64bddd5d656d;p=lhc%2Fweb%2Fwiklou.git Minor followup to r79649. Rename variables --- diff --git a/includes/api/ApiOpenSearch.php b/includes/api/ApiOpenSearch.php index 3b5cca62f7..19741b00fa 100644 --- a/includes/api/ApiOpenSearch.php +++ b/includes/api/ApiOpenSearch.php @@ -52,28 +52,30 @@ class ApiOpenSearch extends ApiBase { // MWSuggest or similar hit if ( $suggest && !$wgEnableOpenSearchSuggest ) { - $srchres = array(); + $searches = array(); } else { - // Open search results may be stored for a very long - // time + // Open search results may be stored for a very long time $this->getMain()->setCacheMaxAge( $wgSearchSuggestCacheExpiry ); $this->getMain()->setCacheMode( 'public' ); - $srchres = PrefixSearch::titleSearch( $search, $limit, + $searches = PrefixSearch::titleSearch( $search, $limit, $namespaces ); // if the content language has variants, try to retrieve fallback results - $fblimit = $limit - count( $srchres ); - if ( $fblimit > 0 ) { + $fallbackLimit = $limit - count( $searches ); + if ( $fallbackLimit > 0 ) { global $wgContLang; - $fbsearchs = $wgContLang->autoConvertToAllVariants( $search ); - $fbsearchs = array_diff( array_unique( $fbsearchs ), ( array ) $search ); - foreach ( $fbsearchs as $fbsearch ) { - $_srchres = PrefixSearch::titleSearch( $fbsearch, $fblimit, + + $fallbackSearches = $wgContLang->autoConvertToAllVariants( $search ); + $fallbackSearches = array_diff( array_unique( $fallbackSearches ), array( $search ) ); + + foreach ( $fallbackSearches as $fbs ) { + $fallbackSearchResult = PrefixSearch::titleSearch( $fbs, $fallbackLimit, $namespaces ); - $srchres = array_merge( $srchres, $_srchres ); - $fblimit -= count( $_srchres ); - if ( $fblimit == 0 ) { + $searches = array_merge( $searches, $fallbackSearchResult ); + $fallbackLimit -= count( $fallbackSearchResult ); + + if ( $fallbackLimit == 0 ) { break; } } @@ -82,7 +84,7 @@ class ApiOpenSearch extends ApiBase { // Set top level elements $result = $this->getResult(); $result->addValue( null, 0, $search ); - $result->addValue( null, 1, $srchres ); + $result->addValue( null, 1, $searches ); } public function getAllowedParams() {