Set main RequestContext title in api.php
authorBrad Jorsch <bjorsch@wikimedia.org>
Sat, 14 Mar 2015 01:11:13 +0000 (21:11 -0400)
committerUmherirrender <umherirrender_de.wp@web.de>
Sun, 15 Mar 2015 19:27:54 +0000 (19:27 +0000)
We set $wgTitle to a dummy title, and RequestContext::getMain()->getTitle()
falls back to that so everything *works*, but RequestContext whines
about it.

Set the same dummy title explicitly on RequestContext::getMain() to shut
things up.

Bug: T78414
Change-Id: I5b90df16cf2f51a6edd5898e9712161f335202a7

api.php

diff --git a/api.php b/api.php
index d63f254..7788a36 100644 (file)
--- a/api.php
+++ b/api.php
@@ -61,6 +61,10 @@ if ( !$wgEnableAPI ) {
 // In a perfect world this wouldn't be necessary
 $wgTitle = Title::makeTitle( NS_MAIN, 'API' );
 
+// RequestContext will read from $wgTitle, but it will also whine about it.
+// In a perfect world this wouldn't be necessary either.
+RequestContext::getMain()->setTitle( $wgTitle );
+
 try {
        /* Construct an ApiMain with the arguments passed via the URL. What we get back
         * is some form of an ApiMain, possibly even one that produces an error message,