dépôts
/
lhc
/
web
/
wiklou.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Merge "Export list of languages which will trigger language conversion"
[lhc/web/wiklou.git]
/
includes
/
api
/
ApiQueryBlocks.php
diff --git
a/includes/api/ApiQueryBlocks.php
b/includes/api/ApiQueryBlocks.php
index
5d7c664
..
0040860
100644
(file)
--- a/
includes/api/ApiQueryBlocks.php
+++ b/
includes/api/ApiQueryBlocks.php
@@
-36,8
+36,6
@@
class ApiQueryBlocks extends ApiQueryBase {
}
public function execute() {
}
public function execute() {
- global $wgContLang;
-
$db = $this->getDB();
$params = $this->extractRequestParams();
$this->requireMaxOneParameter( $params, 'users', 'ip' );
$db = $this->getDB();
$params = $this->extractRequestParams();
$this->requireMaxOneParameter( $params, 'users', 'ip' );
@@
-114,16
+112,13
@@
class ApiQueryBlocks extends ApiQueryBase {
$cidrLimit = $blockCIDRLimit['IPv6'];
$prefixLen = 3; // IP::toHex output is prefixed with "v6-"
} else {
$cidrLimit = $blockCIDRLimit['IPv6'];
$prefixLen = 3; // IP::toHex output is prefixed with "v6-"
} else {
- $this->die
Usage( 'IP parameter is not valid
', 'param_ip' );
+ $this->die
WithError( 'apierror-badip
', 'param_ip' );
}
# Check range validity, if it's a CIDR
list( $ip, $range ) = IP::parseCIDR( $params['ip'] );
if ( $ip !== false && $range !== false && $range < $cidrLimit ) {
}
# Check range validity, if it's a CIDR
list( $ip, $range ) = IP::parseCIDR( $params['ip'] );
if ( $ip !== false && $range !== false && $range < $cidrLimit ) {
- $this->dieUsage(
- "$type CIDR ranges broader than /$cidrLimit are not accepted",
- 'cidrtoobroad'
- );
+ $this->dieWithError( [ 'apierror-cidrtoobroad', $type, $cidrLimit ] );
}
# Let IP::parseRange handle calculating $upper, instead of duplicating the logic here.
}
# Let IP::parseRange handle calculating $upper, instead of duplicating the logic here.
@@
-154,7
+149,7
@@
class ApiQueryBlocks extends ApiQueryBase {
|| ( isset( $show['range'] ) && isset( $show['!range'] ) )
|| ( isset( $show['temp'] ) && isset( $show['!temp'] ) )
) {
|| ( isset( $show['range'] ) && isset( $show['!range'] ) )
|| ( isset( $show['temp'] ) && isset( $show['!temp'] ) )
) {
- $this->die
UsageMsg( '
show' );
+ $this->die
WithError( 'apierror-
show' );
}
$this->addWhereIf( 'ipb_user = 0', isset( $show['!account'] ) );
}
$this->addWhereIf( 'ipb_user = 0', isset( $show['!account'] ) );
@@
-207,7
+202,7
@@
class ApiQueryBlocks extends ApiQueryBase {
$block['timestamp'] = wfTimestamp( TS_ISO_8601, $row->ipb_timestamp );
}
if ( $fld_expiry ) {
$block['timestamp'] = wfTimestamp( TS_ISO_8601, $row->ipb_timestamp );
}
if ( $fld_expiry ) {
- $block['expiry'] =
$wgContLang->formatExpiry( $row->ipb_expiry, TS_ISO_8601
);
+ $block['expiry'] =
ApiResult::formatExpiry( $row->ipb_expiry
);
}
if ( $fld_reason ) {
$block['reason'] = $row->ipb_reason;
}
if ( $fld_reason ) {
$block['reason'] = $row->ipb_reason;
@@
-237,13
+232,19
@@
class ApiQueryBlocks extends ApiQueryBase {
protected function prepareUsername( $user ) {
if ( !$user ) {
protected function prepareUsername( $user ) {
if ( !$user ) {
- $this->dieUsage( 'User parameter may not be empty', 'param_user' );
+ $encParamName = $this->encodeParamName( 'users' );
+ $this->dieWithError( [ 'apierror-baduser', $encParamName, wfEscapeWikiText( $user ) ],
+ "baduser_{$encParamName}"
+ );
}
$name = User::isIP( $user )
? $user
: User::getCanonicalName( $user, 'valid' );
if ( $name === false ) {
}
$name = User::isIP( $user )
? $user
: User::getCanonicalName( $user, 'valid' );
if ( $name === false ) {
- $this->dieUsage( "User name {$user} is not valid", 'param_user' );
+ $encParamName = $this->encodeParamName( 'users' );
+ $this->dieWithError( [ 'apierror-baduser', $encParamName, wfEscapeWikiText( $user ) ],
+ "baduser_{$encParamName}"
+ );
}
return $name;
}
}
return $name;
}