From 7e18081ec4cb5b4f248cf1bab5c413a0786a0c08 Mon Sep 17 00:00:00 2001 From: Ori Livneh Date: Tue, 30 Jul 2013 18:44:01 -0700 Subject: [PATCH] Add a usage note to 'CanonicalNamespaces' hook docs It seems natural to defer namespace configuration until the namespace is actually registered, but in the case of namespaces that are registered in CanonicalNamespaces hook, doing so will not work or cause unpredictable results. This patch adds a note of warning to hooks.txt. See bug 45031 for context. Change-Id: I3f2d56dc7ded5e00974de0baf1a84188eade823c --- docs/hooks.txt | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/docs/hooks.txt b/docs/hooks.txt index 0137f5b131..ab38936a2d 100644 --- a/docs/hooks.txt +++ b/docs/hooks.txt @@ -760,6 +760,14 @@ $output: OutputPage object in use 'CanonicalNamespaces': For extensions adding their own namespaces or altering the defaults. +Note that if you need to specify namespace protection or content model for +a namespace that is added in a CanonicalNamespaces hook handler, you +should do so by altering $wgNamespaceProtection and +$wgNamespaceContentModels outside the handler, in top-level scope. The +point at which the CanonicalNamespaces hook fires is too late for altering +these variables. This applies even if the namespace addition is +conditional; it is permissible to declare a content model and protection +for a namespace and then decline to actually register it. &$namespaces: Array of namespace numbers with corresponding canonical names 'CategoryAfterPageAdded': After a page is added to a category. -- 2.20.1