MediaWiki r109693 - Code Review

Jump to: navigation, search
Repository:MediaWiki
Revision:r109692‎ | r109693 (on ViewVC)‎ | r109694 >
Date:21:36, 21 January 2012
Author:reedy
Status:ok
Tags:
Comment:
* (bug 33865) Exception thrown when using API sandbox action=parse

The actual bug is from wrongly using title when the user wanted page, and hence weren't passing any wikitext...
Modified paths:

Diff [purge]

Index: trunk/phase3/includes/api/ApiParse.php
@@ -47,6 +47,7 @@
4848 if ( !is_null( $page ) && ( !is_null( $text ) || $title != 'API' ) ) {
4949 $this->dieUsage( 'The page parameter cannot be used together with the text and title parameters', 'params' );
5050 }
 51+
5152 $prop = array_flip( $params['prop'] );
5253
5354 if ( isset( $params['section'] ) ) {
@@ -158,6 +159,9 @@
159160 }
160161 } else { // Not $oldid, $pageid, $page. Hence based on $text
161162
 163+ if ( is_null( $text ) ) {
 164+ $this->dieUsage( 'The text parameter should be passed with the title parameter. Should you be using the "page" parameter instead?', 'params' );
 165+ }
162166 $this->text = $text;
163167 $titleObj = Title::newFromText( $title );
164168 if ( !$titleObj ) {
@@ -383,7 +387,7 @@
384388 */
385389 private function languagesHtml( $languages ) {
386390 wfDeprecated( __METHOD__, '1.18' );
387 -
 391+
388392 global $wgContLang, $wgHideInterlanguageLinks;
389393
390394 if ( $wgHideInterlanguageLinks || count( $languages ) == 0 ) {
@@ -571,6 +575,7 @@
572576 public function getPossibleErrors() {
573577 return array_merge( parent::getPossibleErrors(), array(
574578 array( 'code' => 'params', 'info' => 'The page parameter cannot be used together with the text and title parameters' ),
 579+ array( 'code' => 'params', 'info' => 'The text parameter should be passed with the title parameter. Should you be using the "page" parameter instead?' ),
575580 array( 'code' => 'missingrev', 'info' => 'There is no revision ID oldid' ),
576581 array( 'code' => 'permissiondenied', 'info' => 'You don\'t have permission to view deleted revisions' ),
577582 array( 'code' => 'missingtitle', 'info' => 'The page you specified doesn\'t exist' ),

Follow-up revisions

Rev.Commit summaryAuthorDate
r109694MFT r109693 add entry to RELEASE-NOTES-1.18reedy21:44, 21 January 2012
r109695MFT r109693reedy21:44, 21 January 2012

Followed-up revisions

Rev.Commit summaryAuthorDate
r81124Implement prop=wikitext in action=parse, (optionally) returning the original ...catrope01:47, 28 January 2011

Status & tagging log

  • 21:46, 21 January 2012 MaxSem (Talk | contribs) changed the status of r109693 [removed: new added: ok]
Personal tools
Namespaces

Variants
Views
Actions
Site
Support
Download
Development
Communication
Toolbox