X-Git-Url: https://git.heureux-cyclage.org/?p=lhc%2Fweb%2Fwiklou.git;a=blobdiff_plain;f=includes%2Fapi%2FApiQueryAllDeletedRevisions.php;h=020df6d508e892361edc9a32ab932d8c0653a12b;hp=3073a951b0225a7cb8997ff4efa05debb4821796;hb=49748181dd56ec97e7ba7c13e684a16abceb3cc0;hpb=a303296f2730d6279a249bde77f3e0b9b42e494f diff --git a/includes/api/ApiQueryAllDeletedRevisions.php b/includes/api/ApiQueryAllDeletedRevisions.php index 3073a951b0..020df6d508 100644 --- a/includes/api/ApiQueryAllDeletedRevisions.php +++ b/includes/api/ApiQueryAllDeletedRevisions.php @@ -41,15 +41,10 @@ class ApiQueryAllDeletedRevisions extends ApiQueryRevisionsBase { * @return void */ protected function run( ApiPageSet $resultPageSet = null ) { - $user = $this->getUser(); // Before doing anything at all, let's check permissions - if ( !$user->isAllowed( 'deletedhistory' ) ) { - $this->dieUsage( - 'You don\'t have permission to view deleted revision information', - 'permissiondenied' - ); - } + $this->checkUserRightsAny( 'deletedhistory' ); + $user = $this->getUser(); $db = $this->getDB(); $params = $this->extractRequestParams( false ); @@ -75,16 +70,20 @@ class ApiQueryAllDeletedRevisions extends ApiQueryRevisionsBase { foreach ( [ 'from', 'to', 'prefix', 'excludeuser' ] as $param ) { if ( !is_null( $params[$param] ) ) { $p = $this->getModulePrefix(); - $this->dieUsage( "The '{$p}{$param}' parameter cannot be used with '{$p}user'", - 'badparams' ); + $this->dieWithError( + [ 'apierror-invalidparammix-cannotusewith', $p.$param, "{$p}user" ], + 'invalidparammix' + ); } } } else { foreach ( [ 'start', 'end' ] as $param ) { if ( !is_null( $params[$param] ) ) { $p = $this->getModulePrefix(); - $this->dieUsage( "The '{$p}{$param}' parameter may only be used with '{$p}user'", - 'badparams' ); + $this->dieWithError( + [ 'apierror-invalidparammix-mustusewith', $p.$param, "{$p}user" ], + 'invalidparammix' + ); } } } @@ -100,7 +99,7 @@ class ApiQueryAllDeletedRevisions extends ApiQueryRevisionsBase { $optimizeGenerateTitles = true; } else { $p = $this->getModulePrefix(); - $this->setWarning( "For better performance when generating titles, set {$p}dir=newer" ); + $this->addWarning( [ 'apiwarn-alldeletedrevisions-performance', $p ], 'performance' ); } } @@ -148,12 +147,7 @@ class ApiQueryAllDeletedRevisions extends ApiQueryRevisionsBase { $this->addFields( [ 'ar_text', 'ar_flags', 'old_text', 'old_flags' ] ); // This also means stricter restrictions - if ( !$user->isAllowedAny( 'undelete', 'deletedtext' ) ) { - $this->dieUsage( - 'You don\'t have permission to view deleted revision content', - 'permissiondenied' - ); - } + $this->checkUserRightsAny( [ 'deletedtext', 'undelete' ] ); } $miser_ns = null; @@ -236,7 +230,7 @@ class ApiQueryAllDeletedRevisions extends ApiQueryRevisionsBase { } if ( !is_null( $params['user'] ) || !is_null( $params['excludeuser'] ) ) { - // Paranoia: avoid brute force searches (bug 17342) + // Paranoia: avoid brute force searches (T19342) // (shouldn't be able to get here without 'deletedhistory', but // check it again just in case) if ( !$user->isAllowed( 'deletedhistory' ) ) {