r79350 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r79349‎ | r79350 | r79351 >
Date:16:53, 31 December 2010
Author:catrope
Status:ok
Tags:
Comment:
r79347 didn't update other callers to mungeQuery(), so let's just take the easy way out and obtain $dbr inside the function so we don't have to change the parameter list
Modified paths:
  • /trunk/phase3/includes/specials/SpecialLinkSearch.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/specials/SpecialLinkSearch.php
@@ -114,12 +114,13 @@
115115 /**
116116 * Return an appropriately formatted LIKE query and the clause
117117 */
118 - static function mungeQuery( $query, $prot, $dbr ) {
 118+ static function mungeQuery( $query, $prot ) {
119119 $field = 'el_index';
120120 $rv = LinkFilter::makeLikeArray( $query , $prot );
121121 if ( $rv === false ) {
122122 // LinkFilter doesn't handle wildcard in IP, so we'll have to munge here.
123123 if (preg_match('/^(:?[0-9]{1,3}\.)+\*\s*$|^(:?[0-9]{1,3}\.){3}[0-9]{1,3}:[0-9]*\*\s*$/', $query)) {
 124+ $dbr = wfGetDB( DB_SLAVE );
124125 $rv = array( $prot . rtrim( $query, " \t*" ), $dbr->anyString() );
125126 $field = 'el_to';
126127 }
@@ -143,7 +144,7 @@
144145 // strip everything past first wildcard, so that
145146 // index-based-only lookup would be done
146147 list( $this->mMungedQuery, $clause ) = self::mungeQuery(
147 - $this->mQuery, $this->mProt, $dbr );
 148+ $this->mQuery, $this->mProt );
148149 if( $this->mMungedQuery === false )
149150 // Invalid query; return no results
150151 return array( 'tables' => 'page', 'fields' => 'page_id', 'conds' => '0=1' );

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r79347Follow-up r78786: the querypage branch merge threw SpecialLinkSearch back to ...catrope16:44, 31 December 2010

Status & tagging log