X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2Fapi%2FApiQueryWatchlist.php;h=3f597511a1325855bba8a18478ce86eda6600b5d;hb=072551a6bf6d12fc6e1d764225f16987740d04c6;hp=42ea55dd7055e77e3552cab48a1081076f552910;hpb=c99b37bdc05650a38b44f18429437bab6ecc91a8;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/api/ApiQueryWatchlist.php b/includes/api/ApiQueryWatchlist.php index 42ea55dd70..3f597511a1 100644 --- a/includes/api/ApiQueryWatchlist.php +++ b/includes/api/ApiQueryWatchlist.php @@ -82,7 +82,7 @@ class ApiQueryWatchlist extends ApiQueryGeneratorBase { if ( $this->fld_patrol ) { if ( !$user->useRCPatrol() && !$user->useNPPatrol() ) { - $this->dieUsage( 'patrol property is not available', 'patrol' ); + $this->dieWithError( 'apierror-permissiondenied-patrolflag', 'patrol' ); } } } @@ -134,7 +134,7 @@ class ApiQueryWatchlist extends ApiQueryGeneratorBase { /* Check for conflicting parameters. */ if ( $this->showParamsConflicting( $show ) ) { - $this->dieUsageMsg( 'show' ); + $this->dieWithError( 'apierror-show' ); } // Check permissions. @@ -142,10 +142,7 @@ class ApiQueryWatchlist extends ApiQueryGeneratorBase { || isset( $show[WatchedItemQueryService::FILTER_NOT_PATROLLED] ) ) { if ( !$user->useRCPatrol() && !$user->useNPPatrol() ) { - $this->dieUsage( - 'You need the patrol right to request the patrolled flag', - 'permissiondenied' - ); + $this->dieWithError( 'apierror-permissiondenied-patrolflag', 'permissiondenied' ); } } @@ -154,15 +151,16 @@ class ApiQueryWatchlist extends ApiQueryGeneratorBase { if ( !is_null( $params['type'] ) ) { try { - $options['rcTypes'] = RecentChange::parseToRCType( $params['type'] ); + $rcTypes = RecentChange::parseToRCType( $params['type'] ); + if ( $rcTypes ) { + $options['rcTypes'] = $rcTypes; + } } catch ( Exception $e ) { ApiBase::dieDebug( __METHOD__, $e->getMessage() ); } } - if ( !is_null( $params['user'] ) && !is_null( $params['excludeuser'] ) ) { - $this->dieUsage( 'user and excludeuser cannot be used together', 'user-excludeuser' ); - } + $this->requireMaxOneParameter( $params, 'user', 'excludeuser' ); if ( !is_null( $params['user'] ) ) { $options['onlyByUser'] = $params['user']; }