r87705 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r87704‎ | r87705 | r87706 >
Date:06:42, 9 May 2011
Author:bawolff
Status:ok (Comments)
Tags:
Comment:
Make it so that when a special page is trancluded, the output won't vary by url parameter.

This stops severe ugliness http://test.wikipedia.org/wiki/User:Bawolff/special?feed=atom
where the rss feed and the html of the page is concated together.

This could potentially break stuff if someone was using a transcludable special page
with an html form, or if someone is actually passing parameters to the transcludable
special page via the url. I'm not aware of anyone who does that, and both those things
seem rather evil.
Modified paths:
  • /trunk/phase3/RELEASE-NOTES-1.19 (modified) (history)
  • /trunk/phase3/includes/SpecialPageFactory.php (modified) (history)

Diff [purge]

Index: trunk/phase3/RELEASE-NOTES-1.19
@@ -25,6 +25,7 @@
2626 file description page for multi-paged documents.
2727 * (bug 28883) Message names for different compression types commonly
2828 used in Tiff files.
 29+* When translcuding a special page, do not let it interpret url parameters.
2930
3031 === API changes in 1.19 ===
3132
Index: trunk/phase3/includes/SpecialPageFactory.php
@@ -472,13 +472,18 @@
473473 * @return String: HTML fragment
474474 */
475475 static function capturePath( &$title ) {
476 - global $wgOut, $wgTitle;
 476+ global $wgOut, $wgTitle, $wgRequest;
477477
478478 $oldTitle = $wgTitle;
479479 $oldOut = $wgOut;
 480+ $oldRequest = $wgRequest;
480481
 482+ // Don't want special pages interpreting ?feed=atom parameters.
 483+ $wgRequest = new FauxRequest( array() );
 484+
481485 $context = new RequestContext;
482486 $context->setTitle( $title );
 487+ $context->setRequest( $wgRequest );
483488 $wgOut = $context->getOutput();
484489
485490 $ret = self::executePath( $title, $context, true );
@@ -487,6 +492,7 @@
488493 }
489494 $wgTitle = $oldTitle;
490495 $wgOut = $oldOut;
 496+ $wgRequest = $oldRequest;
491497 return $ret;
492498 }
493499
@@ -541,4 +547,4 @@
542548 return null;
543549 }
544550 }
545 -}
\ No newline at end of file
 551+}

Follow-up revisions

RevisionCommit summaryAuthorDate
r91232(Follow-up r87705) per CR add docs to function. No code changes.bawolff22:47, 30 June 2011
r91820Disable feed mode when including the page. I know that there is already r8770...ialex07:33, 10 July 2011

Comments

#Comment by Aaron Schulz (talk | contribs)   04:53, 22 June 2011

At least needs documentation changes to function.

#Comment by Bawolff (talk | contribs)   22:48, 30 June 2011

Status & tagging log