New hook to replace live hack on translatewiki.net. Allows reordering namespaces
authorNiklas Laxström <nikerabbit@users.mediawiki.org>
Tue, 30 Aug 2011 13:24:27 +0000 (13:24 +0000)
committerNiklas Laxström <nikerabbit@users.mediawiki.org>
Tue, 30 Aug 2011 13:24:27 +0000 (13:24 +0000)
docs/hooks.txt
languages/Language.php

index 349a87f..745ae73 100644 (file)
@@ -1089,6 +1089,10 @@ $password: The password entered by the user
 &$result: Set this and return false to override the internal checks
 $user: User the password is being validated for
 
+'LanguageGetNamespaces': Provide custom ordering for namespaces or
+remove namespaces. Do not use this hook to add namespaces.
+&$namespaces: Array of namespaces indexed by their numbers
+
 'LanguageGetMagic': DEPRECATED, use $magicWords in a file listed in 
 $wgExtensionMessagesFiles instead. 
 Use this to define synonyms of magic words depending of the language
index 49067be..308e660 100644 (file)
@@ -341,6 +341,8 @@ class Language {
                        # The above mixing may leave namespaces out of canonical order.
                        # Re-order by namespace ID number...
                        ksort( $this->namespaceNames );
+
+                       wfRunHooks( 'LanguageGetNamespaces', array( &$this->namespaceNames ) );
                }
                return $this->namespaceNames;
        }
@@ -3312,7 +3314,7 @@ class Language {
        }
 
        /**
-        * Get the first fallback for a given language
+        * Get the first fallback for a given language
         *
         * @param $code string
         *