From 7fe16d59a76685b7b8e6c69bdeaea65ea7ef19f6 Mon Sep 17 00:00:00 2001 From: Andrew Garrett Date: Fri, 20 Aug 2010 05:32:24 +0000 Subject: [PATCH] (bug 24837) Fix issue where namespaces which were localised but not defined were returned by Language::getNamespaces() --- languages/Language.php | 8 ++++++++ 1 file changed, 8 insertions(+) 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... -- 2.20.1