r63011 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r63010‎ | r63011 | r63012 >
Date:18:24, 26 February 2010
Author:catrope
Status:ok (Comments)
Tags:
Comment:
API: Don't unstub $wgContLang in ApiBase::getValidNamespaces()
Modified paths:
  • /trunk/phase3/includes/api/ApiBase.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/api/ApiBase.php
@@ -521,10 +521,10 @@
522522 static $mValidNamespaces = null;
523523
524524 if ( is_null( $mValidNamespaces ) ) {
525 - global $wgContLang;
526 - $mValidNamespaces = array();
527 - foreach ( array_keys( $wgContLang->getNamespaces() ) as $ns ) {
528 - if ( $ns >= 0 ) {
 525+ global $wgCanonicalNamespaceNames;
 526+ $mValidNamespaces = array( NS_MAIN ); // Doesn't appear in $wgCanonicalNamespaceNames for some reason
 527+ foreach ( array_keys( $wgCanonicalNamespaceNames ) as $ns ) {
 528+ if ( $ns > 0 ) {
529529 $mValidNamespaces[] = $ns;
530530 }
531531 }

Follow-up revisions

RevisionCommit summaryAuthorDate
r63014wmf-deployment: MFT r63011catrope19:41, 26 February 2010

Comments

#Comment by Midom (talk | contribs)   19:33, 26 February 2010

isn't it better just to return array_keys($wgCanonicalNamespaceNames) instead?

It doesn't need $ns>0, and NS_MAIN is not there anyway ;-)

Status & tagging log