r97222 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r97221‎ | r97222 | r97223 >
Date:00:10, 16 September 2011
Author:brion
Status:ok (Comments)
Tags:
Comment:
* (bug 30921) Fix breakage in dumpHTML on Special:Categories

SkinTemplate::buildContentNavigationUrls() uses $request->getRequestURL() when building the special tab on special page; so when building Special:Categories list we ended up with a fatal exception, as FauxRequest doesn't support that function.
Setting up the article context with a modified DumpFauxRequest that's specific to the article -- and does know to return the URL -- seems to resolve this.
Modified paths:
  • /trunk/extensions/DumpHTML/dumpHTML.inc (modified) (history)

Diff [purge]

Index: trunk/extensions/DumpHTML/dumpHTML.inc
@@ -789,6 +789,8 @@
790790 $linkCache->clear();
791791
792792 $context = new RequestContext();
 793+ $context->setRequest( new DumpFauxRequest( $title->getLocalUrl(),
 794+ array( 'title' => $title->getPrefixedDbKey() ) ) );
793795 $context->setTitle( $title );
794796 $context->setUser( $wgUser );
795797
@@ -1424,4 +1426,22 @@
14251427 /** XML parser callback */
14261428 function wfDumpEndTagHandler( $parser, $name ) {}
14271429
 1430+/**
 1431+ * Workaround for bug 30921; extends FauxRequest to return a fake current URL.
 1432+ * Needed by SkinTemplate::buildContentNavigationUrls for Special: pages.
 1433+ */
 1434+class DumpFauxRequest extends FauxRequest {
 1435+ public function __construct( $url, $data, $wasPosted = false, $session = null ) {
 1436+ parent::__construct( $data, $wasPosted, $session );
 1437+ $this->url = $url;
 1438+ }
 1439+
 1440+ /**
 1441+ * Returns a stub '#' link, suitable for in-page linking to self.
 1442+ * @return string URL
 1443+ */
 1444+ public function getRequestURL() {
 1445+ return $this->url;
 1446+ }
 1447+}
14281448 # vim: syn=php

Comments

#Comment by Aaron Schulz (talk | contribs)   22:29, 29 September 2011

Yuck yuck!

Status & tagging log