Index: trunk/phase3/includes/api/ApiQueryDeletedrevs.php |
— | — | @@ -66,9 +66,9 @@ |
67 | 67 | $titles = $pageSet->getTitles(); |
68 | 68 | |
69 | 69 | // 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) |
73 | 73 | $mode = 'all'; |
74 | 74 | if ( count( $titles ) > 0 ) { |
75 | 75 | $mode = 'revs'; |
— | — | @@ -76,6 +76,21 @@ |
77 | 77 | $mode = 'user'; |
78 | 78 | } |
79 | 79 | |
| 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 | + |
80 | 95 | if ( !is_null( $params['user'] ) && !is_null( $params['excludeuser'] ) ) { |
81 | 96 | $this->dieUsage( 'user and excludeuser cannot be used together', 'badparams' ); |
82 | 97 | } |
— | — | @@ -329,7 +344,7 @@ |
330 | 345 | return array( |
331 | 346 | 'start' => 'The timestamp to start enumerating from (1,2)', |
332 | 347 | '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)' ), |
334 | 349 | 'from' => 'Start listing at this title (3)', |
335 | 350 | 'to' => 'Stop listing at this title (3)', |
336 | 351 | 'prefix' => 'Search for all page titles that begin with this value (3)', |
— | — | @@ -360,9 +375,9 @@ |
361 | 376 | return array( |
362 | 377 | 'List deleted revisions.', |
363 | 378 | '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)", |
367 | 382 | 'Certain parameters only apply to some modes and are ignored in others.', |
368 | 383 | 'For instance, a parameter marked (1) only applies to mode 1 and is ignored in modes 2 and 3', |
369 | 384 | ); |
— | — | @@ -374,6 +389,12 @@ |
375 | 390 | array( 'code' => 'badparams', 'info' => 'user and excludeuser cannot be used together' ), |
376 | 391 | array( 'code' => 'permissiondenied', 'info' => 'You don\'t have permission to view deleted revision content' ), |
377 | 392 | 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" ), |
378 | 399 | ) ); |
379 | 400 | } |
380 | 401 | |
Index: trunk/phase3/RELEASE-NOTES |
— | — | @@ -348,6 +348,7 @@ |
349 | 349 | * (bug 28558) Add iw_api and iw_wikiid to meta=siteinfo&siprop=interwikimap |
350 | 350 | * (bug 26882) Allow listing of indefinite protections with the api |
351 | 351 | * (bug 27344) add drprefix param to list=deletedrevs |
| 352 | +* (bug 28560) list=deletedrevs should die, if combination of param is invalid |
352 | 353 | |
353 | 354 | === Languages updated in 1.18 === |
354 | 355 | |