r43470 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r43469‎ | r43470 | r43471 >
Date:00:30, 14 November 2008
Author:tstarling
Status:ok
Tags:
Comment:
Don't use getParameter() inside substituteResultWithError(), since it will try to call dieUsage() again if the format parameter is invalid. This fixes the error message for invalid formats, which was broken.
Modified paths:
  • /trunk/phase3/includes/api/ApiFormatBase.php (modified) (history)
  • /trunk/phase3/includes/api/ApiMain.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/api/ApiFormatBase.php
@@ -70,6 +70,13 @@
7171 }
7272
7373 /**
 74+ * Get the internal format name
 75+ */
 76+ public function getFormat() {
 77+ return $this->mFormat;
 78+ }
 79+
 80+ /**
7481 * Specify whether or not ampersands should be escaped to '&' when rendering. This
7582 * should only be set to true for the help message when rendered in the default (xmlfm)
7683 * format. This is a temporary special-case fix that should be removed once the help
Index: trunk/phase3/includes/api/ApiMain.php
@@ -445,7 +445,7 @@
446446 * tell the printer not to escape ampersands so that our links do
447447 * not break. */
448448 $printer->setUnescapeAmps ( ( $this->mAction == 'help' || $isError )
449 - && $this->getParameter('format') == ApiMain::API_DEFAULT_FORMAT );
 449+ && $printer->getFormat() == 'XML' && $printer->getIsHtml() );
450450
451451 $printer->initPrinter($isError);
452452

Follow-up revisions

RevisionCommit summaryAuthorDate
r44569Backported r43470, redundant fix for Rem1.tstarling08:31, 14 December 2008

Status & tagging log