Merge "mw.language.convertPlural: Check if matching form exists"
[lhc/web/wiklou.git] / includes / api / ApiBlock.php
index 90432b9..332fa9e 100644 (file)
@@ -42,12 +42,6 @@ class ApiBlock extends ApiBase {
                $user = $this->getUser();
                $params = $this->extractRequestParams();
 
-               if ( $params['gettoken'] ) {
-                       $res['blocktoken'] = $user->getEditToken();
-                       $this->getResult()->addValue( null, $this->getModuleName(), $res );
-                       return;
-               }
-
                if ( !$user->isAllowed( 'block' ) ) {
                        $this->dieUsageMsg( 'cantblock' );
                }
@@ -61,8 +55,11 @@ class ApiBlock extends ApiBase {
                }
 
                $target = User::newFromName( $params['user'] );
-               // Bug 38633 - if the target is a user (not an IP address), but it doesn't exist or is unusable, error.
-               if ( $target instanceof User && ( $target->isAnon() /* doesn't exist */ || !User::isUsableName( $target->getName() ) ) ) {
+               // Bug 38633 - if the target is a user (not an IP address), but it
+               // doesn't exist or is unusable, error.
+               if ( $target instanceof User &&
+                       ( $target->isAnon() /* doesn't exist */ || !User::isUsableName( $target->getName() ) )
+               ) {
                        $this->dieUsageMsg( array( 'nosuchuser', $params['user'] ) );
                }
 
@@ -104,7 +101,7 @@ class ApiBlock extends ApiBase {
                $res['userID'] = $target instanceof User ? $target->getId() : 0;
 
                $block = Block::newFromTarget( $target );
-               if( $block instanceof Block ) {
+               if ( $block instanceof Block ) {
                        $res['expiry'] = $block->mExpiry == $this->getDB()->getInfinity()
                                ? 'infinite'
                                : wfTimestamp( TS_ISO_8601, $block->mExpiry );
@@ -156,10 +153,6 @@ class ApiBlock extends ApiBase {
                                ApiBase::PARAM_REQUIRED => true
                        ),
                        'token' => null,
-                       'gettoken' => array(
-                               ApiBase::PARAM_DFLT => false,
-                               ApiBase::PARAM_DEPRECATED => true,
-                       ),
                        'expiry' => 'never',
                        'reason' => '',
                        'anononly' => false,
@@ -177,15 +170,18 @@ class ApiBlock extends ApiBase {
                return array(
                        'user' => 'Username, IP address or IP range you want to block',
                        '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.',
+                       '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',
                        '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',
-                       'noemail' => 'Prevent user from sending email through the wiki. (Requires the "blockemail" right.)',
+                       'autoblock' => 'Automatically block the last used IP address, and ' .
+                               'any subsequent IP addresses they try to login from',
+                       'noemail'
+                               => 'Prevent user from sending email through the wiki. (Requires the "blockemail" right.)',
                        'hidename' => 'Hide the username from the block log. (Requires the "hideuser" right.)',
-                       'allowusertalk' => 'Allow the user to edit their own talk page (depends on $wgBlockAllowsUTEdit)',
+                       'allowusertalk'
+                               => 'Allow the user to edit their own talk page (depends on $wgBlockAllowsUTEdit)',
                        'reblock' => 'If the user is already blocked, overwrite the existing block',
                        'watchuser' => 'Watch the user/IP\'s user and talk pages',
                );
@@ -194,10 +190,6 @@ 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