r71459 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r71458‎ | r71459 | r71460 >
Date:02:07, 23 August 2010
Author:philip
Status:ok (Comments)
Tags:
Comment:
follow up r69134. Change all of convertLinkToAllVariants()'s callers to call autoConvertToAllVariants().
Modified paths:
  • /trunk/phase3/includes/parser/LinkHolderArray.php (modified) (history)
  • /trunk/phase3/includes/parser/Parser.php (modified) (history)
  • /trunk/phase3/includes/search/SearchEngine.php (modified) (history)
  • /trunk/phase3/languages/Language.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/search/SearchEngine.php
@@ -108,7 +108,7 @@
109109 $allSearchTerms = array( $searchterm );
110110
111111 if ( $wgContLang->hasVariants() ) {
112 - $allSearchTerms = array_merge( $allSearchTerms, $wgContLang->convertLinkToAllVariants( $searchterm ) );
 112+ $allSearchTerms = array_merge( $allSearchTerms, $wgContLang->autoConvertToAllVariants( $searchterm ) );
113113 }
114114
115115 if ( !wfRunHooks( 'SearchGetNearMatchBefore', array( $allSearchTerms, &$titleResult ) ) ) {
Index: trunk/phase3/includes/parser/LinkHolderArray.php
@@ -330,7 +330,7 @@
331331 }
332332
333333 // Now do the conversion and explode string to text of titles
334 - $titlesAllVariants = $wgContLang->convertLinkToAllVariants( $titlesToBeConverted );
 334+ $titlesAllVariants = $wgContLang->autoConvertToAllVariants( $titlesToBeConverted );
335335 $allVariantsName = array_keys( $titlesAllVariants );
336336 foreach ( $titlesAllVariants as &$titlesVariant ) {
337337 $titlesVariant = explode( "\0", $titlesVariant );
@@ -354,7 +354,7 @@
355355 $categoryMap = array(); // maps $category_variant => $category (dbkeys)
356356 $varCategories = array(); // category replacements oldDBkey => newDBkey
357357 foreach( $output->getCategoryLinks() as $category ){
358 - $variants = $wgContLang->convertLinkToAllVariants( $category );
 358+ $variants = $wgContLang->autoConvertToAllVariants( $category );
359359 foreach($variants as $variant){
360360 if($variant != $category){
361361 $variantTitle = Title::newFromDBkey( Title::makeName(NS_CATEGORY,$variant) );
Index: trunk/phase3/includes/parser/Parser.php
@@ -1686,7 +1686,7 @@
16871687 }
16881688
16891689 if ( $wgContLang->hasVariants() ) {
1690 - $selflink = $wgContLang->convertLinkToAllVariants( $this->mTitle->getPrefixedText() );
 1690+ $selflink = $wgContLang->autoConvertToAllVariants( $this->mTitle->getPrefixedText() );
16911691 } else {
16921692 $selflink = array( $this->mTitle->getPrefixedText() );
16931693 }
Index: trunk/phase3/languages/Language.php
@@ -39,7 +39,7 @@
4040 class FakeConverter {
4141 var $mLang;
4242 function FakeConverter( $langobj ) { $this->mLang = $langobj; }
43 - function autoConvertToAllVariants( $text ) { return $text; }
 43+ function autoConvertToAllVariants( $text ) { return array( $this->mLang->getCode() => $text ); }
4444 function convert( $t ) { return $t; }
4545 function convertTitle( $t ) { return $t->getPrefixedText(); }
4646 function getVariants() { return array( $this->mLang->getCode() ); }
@@ -50,7 +50,7 @@
5151 function getParsedTitle() { return ''; }
5252 function markNoConversion( $text, $noParse = false ) { return $text; }
5353 function convertCategoryKey( $key ) { return $key; }
54 - function convertLinkToAllVariants( $text ) { return array( $this->mLang->getCode() => $text ); }
 54+ function convertLinkToAllVariants( $text ) { return autoConvertToAllVariants( $text ); }
5555 function armourMath( $text ) { return $text; }
5656 }
5757

Follow-up revisions

RevisionCommit summaryAuthorDate
r77517Follow up r71459...platonides00:30, 1 December 2010

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r69134* Deprecated convertLinkToAllVariants() since the "{" and "}" are not allowed...philip08:59, 7 July 2010

Comments

#Comment by PhiLiP (talk | contribs)   02:19, 23 August 2010

I changed the behaviour of FakeConverter.autoConvertToAllVariants() to return an array rather than a string, to make sure it will be consistent with LanguageConverter.autoConverterToAllVariants(). All the autoConvertToAllVariants()'s original callers, like SearchIBM_DB2.php, SearchMySQL.php, etc., can handle both situations either a string or an array. So such changing of hehaviour would not effect the original callers.

Do I need to remove the string part from the original callers? They are now no longer necessary.

Status & tagging log