r62410 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r62409‎ | r62410 | r62411 >
Date:01:21, 13 February 2010
Author:reedy
Status:ok (Comments)
Tags:
Comment:
Complete dieUsage errors in 7 more Api files
Modified paths:
  • /trunk/phase3/includes/api/ApiPageSet.php (modified) (history)
  • /trunk/phase3/includes/api/ApiQueryCategoryMembers.php (modified) (history)
  • /trunk/phase3/includes/api/ApiQueryDeletedrevs.php (modified) (history)
  • /trunk/phase3/includes/api/ApiQueryRecentChanges.php (modified) (history)
  • /trunk/phase3/includes/api/ApiQueryUserContributions.php (modified) (history)
  • /trunk/phase3/includes/api/ApiQueryWatchlist.php (modified) (history)
  • /trunk/phase3/includes/api/ApiUpload.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/api/ApiQueryRecentChanges.php
@@ -526,6 +526,14 @@
527527 public function getDescription() {
528528 return 'Enumerate recent changes';
529529 }
 530+
 531+ public function getPossibleErrors() {
 532+ return array_merge( parent::getPossibleErrors(), array(
 533+ array( 'code' => 'show', 'info' => 'Incorrect parameter - mutually exclusive values may not be supplied' ),
 534+ array( 'code' => 'permissiondenied', 'info' => 'You need the patrol right to request the patrolled flag' ),
 535+ array( 'code' => 'user-excludeuser', 'info' => 'user and excludeuser cannot be used together' ),
 536+ ) );
 537+ }
530538
531539 protected function getExamples() {
532540 return array (
Index: trunk/phase3/includes/api/ApiQueryDeletedrevs.php
@@ -314,6 +314,15 @@
315315 'For instance, a parameter marked (1) only applies to mode 1 and is ignored in modes 2 and 3.',
316316 );
317317 }
 318+
 319+ public function getPossibleErrors() {
 320+ return array_merge( parent::getPossibleErrors(), array(
 321+ array( 'code' => 'permissiondenied', 'info' => 'You don\'t have permission to view deleted revision information' ),
 322+ array( 'code' => 'badparams', 'info' => 'user and excludeuser cannot be used together' ),
 323+ array( 'code' => 'permissiondenied', 'info' => 'You don\'t have permission to view deleted revision content' ),
 324+ array( 'code' => 'badcontinue', 'info' => 'Invalid continue param. You should pass the original value returned by the previous query' ),
 325+ ) );
 326+ }
318327
319328 protected function getExamples() {
320329 return array (
Index: trunk/phase3/includes/api/ApiQueryCategoryMembers.php
@@ -275,6 +275,14 @@
276276 public function getDescription() {
277277 return 'List all pages in a given category';
278278 }
 279+
 280+ public function getPossibleErrors() {
 281+ return array_merge( parent::getPossibleErrors(), array(
 282+ array( 'code' => 'notitle', 'info' => 'The cmtitle parameter is required' ),
 283+ array( 'code' => 'invalidcategory', 'info' => 'The category name you entered is not valid' ),
 284+ array( 'code' => 'badcontinue', 'info' => 'Invalid continue param. You should pass the original value returned by the previous query' ),
 285+ ) );
 286+ }
279287
280288 protected function getExamples() {
281289 return array (
Index: trunk/phase3/includes/api/ApiQueryWatchlist.php
@@ -372,6 +372,18 @@
373373 public function getDescription() {
374374 return "Get all recent changes to pages in the logged in user's watchlist";
375375 }
 376+
 377+ public function getPossibleErrors() {
 378+ return array_merge( parent::getPossibleErrors(), array(
 379+ array( 'code' => 'bad_wlowner', 'info' => 'Specified user does not exist' ),
 380+ array( 'code' => 'bad_wltoken', 'info' => 'Incorrect watchlist token provided -- please set a correct token in Special:Preferences' ),
 381+ array( 'code' => 'notloggedin', 'info' => 'You must be logged-in to have a watchlist' ),
 382+ array( 'code' => 'patrol', 'info' => 'patrol property is not available' ),
 383+ array( 'code' => 'show', 'info' => 'Incorrect parameter - mutually exclusive values may not be supplied' ),
 384+ array( 'code' => 'permissiondenied', 'info' => 'You need the patrol right to request the patrolled flag' ),
 385+ array( 'code' => 'user-excludeuser', 'info' => 'user and excludeuser cannot be used together' ),
 386+ ) );
 387+ }
376388
377389 protected function getExamples() {
378390 return array (
Index: trunk/phase3/includes/api/ApiPageSet.php
@@ -691,6 +691,13 @@
692692 );
693693 }
694694
 695+ public function getPossibleErrors() {
 696+ return array_merge( parent::getPossibleErrors(), array(
 697+ array( 'code' => 'multisource', 'info' => "Cannot use 'pageids' at the same time as 'dataSource'" ),
 698+ array( 'code' => 'multisource', 'info' => "Cannot use 'revids' at the same time as 'dataSource'" ),
 699+ ) );
 700+ }
 701+
695702 public function getVersion() {
696703 return __CLASS__ . ': $Id$';
697704 }
Index: trunk/phase3/includes/api/ApiUpload.php
@@ -339,6 +339,14 @@
340340 array( 'mustbeloggedin', 'upload' ),
341341 array( 'badaccess-groups' ),
342342 array( 'badaccess-groups' ),
 343+ array( 'code' => 'fetchfileerror', 'info' => '' ),
 344+ array( 'code' => 'nomodule', 'info' => 'No upload module set' ),
 345+ array( 'code' => 'empty-file', 'info' => 'The file you submitted was empty' ),
 346+ array( 'code' => 'filetype-missing', 'info' => 'The file is missing an extension' ),
 347+ array( 'code' => 'filename-tooshort', 'info' => 'The filename is too short' ),
 348+ array( 'code' => 'overwrite', 'info' => 'Overwriting an existing file is not allowed' ),
 349+ array( 'code' => 'stashfailed', 'info' => 'Stashing temporary file failed' ),
 350+ array( 'code' => 'internal-error', 'info' => 'An internal error occurred' ),
343351 ) );
344352 }
345353
Index: trunk/phase3/includes/api/ApiQueryUserContributions.php
@@ -417,6 +417,15 @@
418418 public function getDescription() {
419419 return 'Get all edits by a user';
420420 }
 421+
 422+ public function getPossibleErrors() {
 423+ return array_merge( parent::getPossibleErrors(), array(
 424+ array( 'code' => 'param_user', 'info' => 'User parameter may not be empty.' ),
 425+ array( 'code' => 'param_user', 'info' => 'User name user is not valid' ),
 426+ array( 'code' => 'show', 'info' => 'Incorrect parameter - mutually exclusive values may not be supplied' ),
 427+ array( 'code' => 'permissiondenied', 'info' => 'You need the patrol right to request the patrolled flag' ),
 428+ ) );
 429+ }
421430
422431 protected function getExamples() {
423432 return array (

Comments

#Comment by Catrope (talk | contribs)   14:11, 14 February 2010
+			array( 'code' => 'fetchfileerror', 'info' => '' ),

Oops?

#Comment by Reedy (talk | contribs)   14:31, 14 February 2010

return $this->dieUsage( $status->getWikiText(), 'fetchfileerror' );

Not sure what to put for the info for that one?

Certainly an oops

#Comment by Catrope (talk | contribs)   14:39, 14 February 2010

Bleh, that error is evil, and should be fixed in the upload backend if possible. In the meantime this is probably fine.

Status & tagging log