r47055 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r47054‎ | r47055 | r47056 >
Date:22:02, 9 February 2009
Author:minuteelectron
Status:deferred
Tags:
Comment:
* Babel: (bug 16192) Links to level zero categories no longer made when they are disabled.
* Babel: Fix comparison issue when evaluating the addition of the page to a level zero category.
Modified paths:
  • /trunk/extensions/Babel/Babel.class.php (modified) (history)

Diff [purge]

Index: trunk/extensions/Babel/Babel.class.php
@@ -437,13 +437,20 @@
438438 */
439439 private function _getText( $name, $language, $level ) {
440440
441 - global $wgTitle;
 441+ global $wgTitle, $wgBabelUseLevelZeroCategory;
442442
 443+ $categoryLevel = ":Category:{$this->_addFixes( "$language-$level",'category' )}";
 444+ $categorySuper = ":Category:{$this->_addFixes( $language,'category' )}";
 445+
 446+ if( !$wgBabelUseLevelZeroCategory && $level === '0' ) {
 447+ $categoryLevel = $wgTitle->getFullText();
 448+ }
 449+
443450 // Try the language of the box in female.
444451 $text = wfMsgExt( "babel-$level-n",
445452 array( 'language' => $language, 'parsemag' ),
446 - ":Category:{$this->_addFixes( "$language-$level",'category' )}",
447 - ":Category:{$this->_addFixes( $language,'category' )}",
 453+ $categoryLevel,
 454+ $categorySuper,
448455 '',
449456 $wgTitle->getDBkey()
450457 );
@@ -451,8 +458,8 @@
452459 // Get the fallback message for comparison in female.
453460 $fallback = wfMsgExt( "babel-$level-n",
454461 array( 'language' => Language::getFallbackfor( $language ), 'parsemag' ),
455 - ":Category:{$this->_addFixes( "$language-$level",'category' )}",
456 - ":Category:{$this->_addFixes( $language,'category' )}",
 462+ $categoryLevel,
 463+ $categorySuper,
457464 '',
458465 $wgTitle->getDBkey()
459466 );
@@ -463,8 +470,8 @@
464471
465472 $text = wfMsgExt( "babel-$level",
466473 array( 'language' => $language, 'parsemag' ),
467 - ":Category:{$this->_addFixes( "$language-$level",'category')}",
468 - ":Category:{$this->_addFixes( $language,'category' )}",
 474+ $categoryLevel,
 475+ $categorySuper,
469476 $name,
470477 $wgTitle->getDBkey()
471478 );
@@ -499,7 +506,7 @@
500507 $r = '';
501508
502509 // Add to main language category if the level is not zero.
503 - if( $wgBabelUseMainCategories && ( $level === 'N' || ( $wgBabelUseLevelZeroCategory && $level === 0 ) || $level > 0 ) ) {
 510+ if( $wgBabelUseMainCategories && ( $level === 'N' || ( $wgBabelUseLevelZeroCategory && $level === '0' ) || $level > 0 ) ) {
504511
505512 // Add category wikitext to box tower.
506513 $r .= "[[Category:{$this->_addFixes( $code,'category' )}|$level{$wgUser->getName()}]]";
@@ -510,7 +517,7 @@
511518
512519 // Add to level categories, only adding it to the level 0
513520 // one if it is set to be used.
514 - if( !$wgBabelUseSimpleCategories && ( $level === 'N' || ( $wgBabelUseLevelZeroCategory && $level === 0 ) || $level > 0 ) ) {
 521+ if( !$wgBabelUseSimpleCategories && ( $level === 'N' || ( $wgBabelUseLevelZeroCategory && $level === '0' ) || $level > 0 ) ) {
515522
516523 // Add category wikitext to box tower.
517524 $r .= "[[Category:{$this->_addFixes( "$code-$level",'category' )}|{$wgUser->getName()}]]";

Status & tagging log