r86782 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r86781‎ | r86782 | r86783 >
Date:16:57, 23 April 2011
Author:reedy
Status:ok (Comments)
Tags:
Comment:
* (bug 28560) list=deletedrevs should die, if combination of param is invalid

No checking for NS or unique in the mode 1/2 checks, as they have defaults of 0 and false, which is impossible to determine if they had been set as that, or just using the defaults. They are ignored in the code still on the incorrect path

Update usage of dir
Modified paths:
  • /trunk/phase3/RELEASE-NOTES (modified) (history)
  • /trunk/phase3/includes/api/ApiQueryDeletedrevs.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/api/ApiQueryDeletedrevs.php
@@ -66,9 +66,9 @@
6767 $titles = $pageSet->getTitles();
6868
6969 // This module operates in three modes:
70 - // 'revs': List deleted revs for certain titles
71 - // 'user': List deleted revs by a certain user
72 - // 'all': List all deleted revs
 70+ // 'revs': List deleted revs for certain titles (1)
 71+ // 'user': List deleted revs by a certain user (2)
 72+ // 'all': List all deleted revs in NS (3)
7373 $mode = 'all';
7474 if ( count( $titles ) > 0 ) {
7575 $mode = 'revs';
@@ -76,6 +76,21 @@
7777 $mode = 'user';
7878 }
7979
 80+ if ( $mode == 'revs' || $mode == 'user' ) {
 81+ // Ignore namespace and unique due to inability to know whether they were purposely set
 82+ foreach( array( 'from', 'to', 'prefix', /*'namespace',*/ 'continue', /*'unique'*/ ) as $p ) {
 83+ if ( !is_null( $params[$p] ) ) {
 84+ $this->dieUsage( "The '{$p}' parameter cannot be used in modes 1 or 2", 'badparams');
 85+ }
 86+ }
 87+ } else {
 88+ foreach( array( 'start', 'end' ) as $p ) {
 89+ if ( !is_null( $params[$p] ) ) {
 90+ $this->dieUsage( "The {$p} parameter cannot be used in mode 3", 'badparams');
 91+ }
 92+ }
 93+ }
 94+
8095 if ( !is_null( $params['user'] ) && !is_null( $params['excludeuser'] ) ) {
8196 $this->dieUsage( 'user and excludeuser cannot be used together', 'badparams' );
8297 }
@@ -329,7 +344,7 @@
330345 return array(
331346 'start' => 'The timestamp to start enumerating from (1,2)',
332347 'end' => 'The timestamp to stop enumerating at (1,2)',
333 - 'dir' => $this->getDirectionDescription( $this->getModulePrefix(), ' (1,2)' ),
 348+ 'dir' => $this->getDirectionDescription( $this->getModulePrefix(), ' (1, 3)' ),
334349 'from' => 'Start listing at this title (3)',
335350 'to' => 'Stop listing at this title (3)',
336351 'prefix' => 'Search for all page titles that begin with this value (3)',
@@ -360,9 +375,9 @@
361376 return array(
362377 'List deleted revisions.',
363378 'This module operates in three modes:',
364 - '1) List deleted revisions for the given title(s), sorted by timestamp',
365 - '2) List deleted contributions for the given user, sorted by timestamp (no titles specified)',
366 - "3) List all deleted revisions in the given namespace, sorted by title and timestamp (no titles specified, {$p}user not set)",
 379+ ' 1) List deleted revisions for the given title(s), sorted by timestamp',
 380+ ' 2) List deleted contributions for the given user, sorted by timestamp (no titles specified)',
 381+ " 3) List all deleted revisions in the given namespace, sorted by title and timestamp (no titles specified, {$p}user not set)",
367382 'Certain parameters only apply to some modes and are ignored in others.',
368383 'For instance, a parameter marked (1) only applies to mode 1 and is ignored in modes 2 and 3',
369384 );
@@ -374,6 +389,12 @@
375390 array( 'code' => 'badparams', 'info' => 'user and excludeuser cannot be used together' ),
376391 array( 'code' => 'permissiondenied', 'info' => 'You don\'t have permission to view deleted revision content' ),
377392 array( 'code' => 'badcontinue', 'info' => 'Invalid continue param. You should pass the original value returned by the previous query' ),
 393+ array( 'code' => 'badparams', 'info' => "The 'from' parameter cannot be used in modes 1 or 2" ),
 394+ array( 'code' => 'badparams', 'info' => "The 'to' parameter cannot be used in modes 1 or 2" ),
 395+ array( 'code' => 'badparams', 'info' => "The 'prefix' parameter cannot be used in modes 1 or 2" ),
 396+ array( 'code' => 'badparams', 'info' => "The 'continue' parameter cannot be used in modes 1 or 2" ),
 397+ array( 'code' => 'badparams', 'info' => "The 'start' parameter cannot be used in mode 3" ),
 398+ array( 'code' => 'badparams', 'info' => "The 'end' parameter cannot be used in mode 3" ),
378399 ) );
379400 }
380401
Index: trunk/phase3/RELEASE-NOTES
@@ -348,6 +348,7 @@
349349 * (bug 28558) Add iw_api and iw_wikiid to meta=siteinfo&siprop=interwikimap
350350 * (bug 26882) Allow listing of indefinite protections with the api
351351 * (bug 27344) add drprefix param to list=deletedrevs
 352+* (bug 28560) list=deletedrevs should die, if combination of param is invalid
352353
353354 === Languages updated in 1.18 ===
354355

Comments

#Comment by Nikerabbit (talk | contribs)   17:25, 23 April 2011

/me fails to parse the commit message

Status & tagging log