From 63601400e476c6cf43d985f3e7b9864681695ed4 Mon Sep 17 00:00:00 2001 From: Pierre Schmitz Date: Fri, 18 Jan 2013 16:46:04 +0100 Subject: Update to MediaWiki 1.20.2 this update includes: * adjusted Arch Linux skin * updated FluxBBAuthPlugin * patch for https://bugzilla.wikimedia.org/show_bug.cgi?id=44024 --- includes/api/ApiBlock.php | 61 ++++++++++++++++++++++++++++++++++++++++------- 1 file changed, 52 insertions(+), 9 deletions(-) (limited to 'includes/api/ApiBlock.php') diff --git a/includes/api/ApiBlock.php b/includes/api/ApiBlock.php index 351ac6b7..c879b35d 100644 --- a/includes/api/ApiBlock.php +++ b/includes/api/ApiBlock.php @@ -4,7 +4,7 @@ * * Created on Sep 4, 2007 * - * Copyright © 2007 Roan Kattouw .@gmail.com + * Copyright © 2007 Roan Kattouw ".@gmail.com" * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -47,7 +47,7 @@ class ApiBlock extends ApiBase { $params = $this->extractRequestParams(); if ( $params['gettoken'] ) { - $res['blocktoken'] = $user->getEditToken( '', $this->getMain()->getRequest() ); + $res['blocktoken'] = $user->getEditToken(); $this->getResult()->addValue( null, $this->getModuleName(), $res ); return; } @@ -72,9 +72,9 @@ class ApiBlock extends ApiBase { $data = array( 'Target' => $params['user'], 'Reason' => array( - is_null( $params['reason'] ) ? '' : $params['reason'], + $params['reason'], 'other', - is_null( $params['reason'] ) ? '' : $params['reason'] + $params['reason'] ), 'Expiry' => $params['expiry'] == 'never' ? 'infinite' : $params['expiry'], 'HardBlock' => !$params['anononly'], @@ -100,12 +100,14 @@ class ApiBlock extends ApiBase { $block = Block::newFromTarget( $target ); if( $block instanceof Block ){ - $res['expiry'] = $block->mExpiry == wfGetDB( DB_SLAVE )->getInfinity() + $res['expiry'] = $block->mExpiry == $this->getDB()->getInfinity() ? 'infinite' : wfTimestamp( TS_ISO_8601, $block->mExpiry ); + $res['id'] = $block->getId(); } else { # should be unreachable $res['expiry'] = ''; + $res['id'] = ''; } $res['reason'] = $params['reason']; @@ -149,9 +151,12 @@ class ApiBlock extends ApiBase { ApiBase::PARAM_REQUIRED => true ), 'token' => null, - 'gettoken' => false, + 'gettoken' => array( + ApiBase::PARAM_DFLT => false, + ApiBase::PARAM_DEPRECATED => true, + ), 'expiry' => 'never', - 'reason' => null, + 'reason' => '', 'anononly' => false, 'nocreate' => false, 'autoblock' => false, @@ -166,10 +171,10 @@ class ApiBlock extends ApiBase { public function getParamDescription() { return array( 'user' => 'Username, IP address or IP range you want to block', - 'token' => 'A block token previously obtained through the gettoken parameter or prop=info', + 'token' => 'A block token previously obtained through prop=info', 'gettoken' => 'If set, a block token will be returned, and no other action will be taken', 'expiry' => 'Relative expiry time, e.g. \'5 months\' or \'2 weeks\'. If set to \'infinite\', \'indefinite\' or \'never\', the block will never expire.', - 'reason' => 'Reason for block (optional)', + 'reason' => 'Reason for block', 'anononly' => 'Block anonymous users only (i.e. disable anonymous edits for this IP)', 'nocreate' => 'Prevent account creation', 'autoblock' => 'Automatically block the last used IP address, and any subsequent IP addresses they try to login from', @@ -181,6 +186,44 @@ class ApiBlock extends ApiBase { ); } + public function getResultProperties() { + return array( + '' => array( + 'blocktoken' => array( + ApiBase::PROP_TYPE => 'string', + ApiBase::PROP_NULLABLE => true + ), + 'user' => array( + ApiBase::PROP_TYPE => 'string', + ApiBase::PROP_NULLABLE => true + ), + 'userID' => array( + ApiBase::PROP_TYPE => 'integer', + ApiBase::PROP_NULLABLE => true + ), + 'expiry' => array( + ApiBase::PROP_TYPE => 'string', + ApiBase::PROP_NULLABLE => true + ), + 'id' => array( + ApiBase::PROP_TYPE => 'integer', + ApiBase::PROP_NULLABLE => true + ), + 'reason' => array( + ApiBase::PROP_TYPE => 'string', + ApiBase::PROP_NULLABLE => true + ), + 'anononly' => 'boolean', + 'nocreate' => 'boolean', + 'autoblock' => 'boolean', + 'noemail' => 'boolean', + 'hidename' => 'boolean', + 'allowusertalk' => 'boolean', + 'watchuser' => 'boolean' + ) + ); + } + public function getDescription() { return 'Block a user'; } -- cgit v1.2.3-54-g00ecf