Index: trunk/phase3/includes/api/ApiFormatBase.php |
— | — | @@ -100,6 +100,16 @@ |
101 | 101 | public function getIsHtml() { |
102 | 102 | return $this->mIsHtml; |
103 | 103 | } |
| 104 | + |
| 105 | + /** |
| 106 | + * Whether this formatter can format the help message in a nice way. |
| 107 | + * By default, this returns the same as getIsHtml(). |
| 108 | + * When action=help is set explicitly, the help will always be shown |
| 109 | + * @return bool |
| 110 | + */ |
| 111 | + public function getWantsHelp() { |
| 112 | + return $this->getIsHtml(); |
| 113 | + } |
104 | 114 | |
105 | 115 | /** |
106 | 116 | * Initialize the printer function and prepare the output headers, etc. |
Index: trunk/phase3/includes/api/ApiFormatJson.php |
— | — | @@ -47,6 +47,11 @@ |
48 | 48 | public function getNeedsRawData() { |
49 | 49 | return $this->mIsRaw; |
50 | 50 | } |
| 51 | + |
| 52 | + public function getWantsHelp() { |
| 53 | + // Help is always ugly in JSON |
| 54 | + return false; |
| 55 | + } |
51 | 56 | |
52 | 57 | public function execute() { |
53 | 58 | $prefix = $suffix = ""; |
Index: trunk/phase3/includes/api/ApiMain.php |
— | — | @@ -311,7 +311,7 @@ |
312 | 312 | 'info' => $e->getMessage()); |
313 | 313 | |
314 | 314 | // Only print the help message when this is for the developer, not runtime |
315 | | - if ($this->mPrinter->getIsHtml() || $this->mAction == 'help') |
| 315 | + if ($this->mPrinter->getWantsHelp() || $this->mAction == 'help') |
316 | 316 | ApiResult :: setContent($errMessage, $this->makeHelpMsg()); |
317 | 317 | |
318 | 318 | } else { |
Index: trunk/phase3/RELEASE-NOTES |
— | — | @@ -434,6 +434,7 @@ |
435 | 435 | * (bug 13049) "API must be accessed from the primary script entry point" error |
436 | 436 | * (bug 18601) generator=backlinks returns invalid continue parameter |
437 | 437 | * (bug 18597) Internal error with empty generator= parameter |
| 438 | +* (bug 16422) Don't display help for format=jsonfm unless specifically requested |
438 | 439 | |
439 | 440 | === Languages updated in 1.15 === |
440 | 441 | |