From ea8428af0f25f6973bd44f8b9a0e2cdc2bfa30a8 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Niklas=20Laxstr=C3=B6m?= Date: Tue, 24 Aug 2010 19:58:55 +0000 Subject: [PATCH] Added a hook into MWNamespace::getCanonicalNamespaces() to provide safe way to 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 | 3 +++ includes/Namespace.php | 1 + 2 files changed, 4 insertions(+) diff --git a/docs/hooks.txt b/docs/hooks.txt index 6c26a1f1e8..44bed243d0 100644 --- a/docs/hooks.txt +++ b/docs/hooks.txt @@ -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 diff --git a/includes/Namespace.php b/includes/Namespace.php index a2d438662b..87fda8c123 100644 --- a/includes/Namespace.php +++ b/includes/Namespace.php @@ -135,6 +135,7 @@ class MWNamespace { $namespaces = $wgCanonicalNamespaceNames; } $namespaces[NS_MAIN] = ''; + wfRunHooks( 'CanonicalNamespaces', array( &$namespaces ) ); } return $namespaces; } -- 2.20.1