(bug 31469) Make sure tracking category messages expand variables like
authorBrian Wolff <bawolff@users.mediawiki.org>
Fri, 30 Dec 2011 06:44:38 +0000 (06:44 +0000)
committerBrian Wolff <bawolff@users.mediawiki.org>
Fri, 30 Dec 2011 06:44:38 +0000 (06:44 +0000)
{{NAMESPACE}} relative to the Title of the currently being parsed page.

Basically wfMsgForContent expands messages with wrong title while doing linksupdate stuff via job queue. For the broken file tracking category (r86534),Wikipedia folk want to sort the page into different categories based on namespace, and for some namespaces not categorize them at all (After all, a broken file link in a talk namespace is often not a bad thing).

Anyhow, explicitly set the title object for the message using wfMessage. There's probably deeper issues here in regards to why wfMsg et al is using wrong title, but this should fix the immediate issue.

RELEASE-NOTES-1.19
includes/parser/Parser.php

index 5e39e81..a1bac75 100644 (file)
@@ -201,6 +201,9 @@ production.
   should be loaded in <head> for proper dependency resolution
 * (bug 32702) Removed method Skin::makeGlobalVariablesScript() has been readded
   for backward compatibility
+* (bug 31469) Make sure tracking category messages expand variables like
+  {{NAMESPACE}} relative to correct title.
+  
 
 === API changes in 1.19 ===
 * (bug 19838) siprop=interwikimap can now use the interwiki cache.
index 94ceaed..2949dcc 100644 (file)
@@ -3859,7 +3859,11 @@ class Parser {
                        wfDebug( __METHOD__.": Not adding tracking category $msg to special page!\n" );
                        return false;
                }
-               $cat = wfMsgForContent( $msg );
+               // Important to parse with correct title (bug 31469)
+               $cat = wfMessage( $msg )
+                       ->title( $this->getTitle() )
+                       ->inContentLanguage()
+                       ->text();
 
                # Allow tracking categories to be disabled by setting them to "-"
                if ( $cat === '-' ) {