Added a hook into MWNamespace::getCanonicalNamespaces() to provide safe way to
authorNiklas Laxström <nikerabbit@users.mediawiki.org>
Tue, 24 Aug 2010 19:58:55 +0000 (19:58 +0000)
committerNiklas Laxström <nikerabbit@users.mediawiki.org>
Tue, 24 Aug 2010 19:58:55 +0000 (19:58 +0000)
define new namespaces in extensions.

Without the hook the list could be initialised too early and some namespaces
would be left undefined. Was causing problems at translatewiki.net.

docs/hooks.txt
includes/Namespace.php

index 6c26a1f..44bed24 100644 (file)
@@ -569,6 +569,9 @@ $user: the user who did the block (not the one being blocked)
 'BookInformation': Before information output on Special:Booksources
 $isbn: ISBN to show information for
 $output: OutputPage object in use
+
+'CanonicalNamespaces': For extensions adding their own namespaces or altering the defaults
+&$namespaces: Array of namespace numbers with they canonical names
  
 'CategoryPageView': before viewing a categorypage in CategoryPage::view
 $catpage: CategoryPage instance
index a2d4386..87fda8c 100644 (file)
@@ -135,6 +135,7 @@ class MWNamespace {
                                $namespaces = $wgCanonicalNamespaceNames;
                        }
                        $namespaces[NS_MAIN] = '';
+                       wfRunHooks( 'CanonicalNamespaces', array( &$namespaces ) );
                }
                return $namespaces;
        }