From: Andrew Garrett Date: Fri, 20 Aug 2010 05:32:24 +0000 (+0000) Subject: (bug 24837) Fix issue where namespaces which were localised but not defined were... X-Git-Tag: 1.31.0-rc.0~35437 X-Git-Url: http://git.cyclocoop.org/%24href?a=commitdiff_plain;h=7fe16d59a76685b7b8e6c69bdeaea65ea7ef19f6;p=lhc%2Fweb%2Fwiklou.git (bug 24837) Fix issue where namespaces which were localised but not defined were returned by Language::getNamespaces() --- diff --git a/languages/Language.php b/languages/Language.php index b0b2a4c9b6..30561437b4 100644 --- a/languages/Language.php +++ b/languages/Language.php @@ -256,6 +256,14 @@ class Language { $this->namespaceNames[NS_PROJECT_TALK] = $this->fixVariableInNamespace( $talk ); } + + # Sometimes a language will be localised but not actually exist on this wiki. + $validNamespaces = MWNamespace::getValidNamespaces(); + foreach( $this->namespaceNames as $key => $text ) { + if ( ! in_array( $key, $validNamespaces ) ) { + unset( $this->namespaceNames[$key] ); + } + } # The above mixing may leave namespaces out of canonical order. # Re-order by namespace ID number...