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' );
$pageSet = $this->getPageSet();
$pageMap = $pageSet->getGoodAndMissingTitlesByNamespace();
$db = $this->getDB();
- if ( !is_null( $params['user'] ) && !is_null( $params['excludeuser'] ) ) {
- $this->dieUsage( 'user and excludeuser cannot be used together', 'badparams' );
- }
+ $this->requireMaxOneParameter( $params, 'user', 'excludeuser' );
$this->addTables( 'archive' );
if ( $resultPageSet === null ) {
$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' ] );
}
$dir = $params['dir'];
}
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' ) ) {