X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2Fapi%2FApiQueryRecentChanges.php;h=2c76e971058b53c8bfbcae2912a0d9ab24ae1989;hb=fb52b789201fcad7a243c13f4371a69d1976369a;hp=8b11dc2a47d2169c9976594f48e9ca2a5afd6110;hpb=9e8cdbbb66dbb607daec04b63327b61448fe43e9;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/api/ApiQueryRecentChanges.php b/includes/api/ApiQueryRecentChanges.php index 8b11dc2a47..2c76e97105 100644 --- a/includes/api/ApiQueryRecentChanges.php +++ b/includes/api/ApiQueryRecentChanges.php @@ -195,7 +195,7 @@ class ApiQueryRecentChanges extends ApiQueryGeneratorBase { || ( isset( $show['patrolled'] ) && isset( $show['unpatrolled'] ) ) || ( isset( $show['!patrolled'] ) && isset( $show['unpatrolled'] ) ) ) { - $this->dieUsageMsg( 'show' ); + $this->dieWithError( 'apierror-show' ); } // Check permissions @@ -204,10 +204,7 @@ class ApiQueryRecentChanges extends ApiQueryGeneratorBase { || isset( $show['unpatrolled'] ) ) { if ( !$user->useRCPatrol() && !$user->useNPPatrol() ) { - $this->dieUsage( - 'You need patrol or patrolmarks permission to request the patrolled flag', - 'permissiondenied' - ); + $this->dieWithError( 'apierror-permissiondenied-patrolflag', 'permissiondenied' ); } } @@ -239,9 +236,7 @@ class ApiQueryRecentChanges extends ApiQueryGeneratorBase { ); } - 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'] ) ) { $this->addWhereFld( 'rc_user_text', $params['user'] ); @@ -274,10 +269,7 @@ class ApiQueryRecentChanges extends ApiQueryGeneratorBase { $this->initProperties( $prop ); if ( $this->fld_patrolled && !$user->useRCPatrol() && !$user->useNPPatrol() ) { - $this->dieUsage( - 'You need patrol or patrolmarks permission to request the patrolled flag', - 'permissiondenied' - ); + $this->dieWithError( 'apierror-permissiondenied-patrolflag', 'permissiondenied' ); } /* Add fields to our query if they are specified as a needed parameter. */ @@ -571,7 +563,7 @@ class ApiQueryRecentChanges extends ApiQueryGeneratorBase { $val = call_user_func( $tokenFunctions[$t], $row->rc_cur_id, $title, RecentChange::newFromRow( $row ) ); if ( $val === false ) { - $this->setWarning( "Action '$t' is not allowed for the current user" ); + $this->addWarning( [ 'apiwarn-tokennotallowed', $t ] ); } else { $vals[$t . 'token'] = $val; } @@ -625,7 +617,8 @@ class ApiQueryRecentChanges extends ApiQueryGeneratorBase { ], 'namespace' => [ ApiBase::PARAM_ISMULTI => true, - ApiBase::PARAM_TYPE => 'namespace' + ApiBase::PARAM_TYPE => 'namespace', + ApiBase::PARAM_EXTRA_NAMESPACES => [ NS_MEDIA, NS_SPECIAL ], ], 'user' => [ ApiBase::PARAM_TYPE => 'user'