Merge "Web installer: correctly show note for I4ecd0659"
[lhc/web/wiklou.git] / includes / api / ApiUnblock.php
index 5802a98..6a739a2 100644 (file)
  */
 class ApiUnblock extends ApiBase {
 
-       public function __construct( $main, $action ) {
-               parent::__construct( $main, $action );
-       }
-
        /**
         * Unblocks the specified user or provides the reason the unblock failed.
         */
@@ -43,12 +39,6 @@ class ApiUnblock extends ApiBase {
                $user = $this->getUser();
                $params = $this->extractRequestParams();
 
-               if ( $params['gettoken'] ) {
-                       $res['unblocktoken'] = $user->getEditToken();
-                       $this->getResult()->addValue( null, $this->getModuleName(), $res );
-                       return;
-               }
-
                if ( is_null( $params['id'] ) && is_null( $params['user'] ) ) {
                        $this->dieUsageMsg( 'unblock-notarget' );
                }
@@ -79,7 +69,7 @@ class ApiUnblock extends ApiBase {
 
                $res['id'] = $block->getId();
                $target = $block->getType() == Block::TYPE_AUTO ? '' : $block->getTarget();
-               $res['user'] = $target;
+               $res['user'] = $target instanceof User ? $target->getName() : $target;
                $res['userid'] = $target instanceof User ? $target->getId() : 0;
                $res['reason'] = $params['reason'];
                $this->getResult()->addValue( null, $this->getModuleName(), $res );
@@ -100,10 +90,6 @@ class ApiUnblock extends ApiBase {
                        ),
                        'user' => null,
                        'token' => null,
-                       'gettoken' => array(
-                               ApiBase::PARAM_DFLT => false,
-                               ApiBase::PARAM_DEPRECATED => true,
-                       ),
                        'reason' => '',
                );
        }
@@ -114,7 +100,6 @@ class ApiUnblock extends ApiBase {
                        'id' => "ID of the block you want to unblock (obtained through list=blocks). Cannot be used together with {$p}user",
                        'user' => "Username, IP address or IP range you want to unblock. Cannot be used together with {$p}id",
                        'token' => "An unblock token previously obtained through prop=info",
-                       'gettoken' => 'If set, an unblock token will be returned, and no other action will be taken',
                        'reason' => 'Reason for unblock',
                );
        }
@@ -122,10 +107,6 @@ class ApiUnblock extends ApiBase {
        public function getResultProperties() {
                return array(
                        '' => array(
-                               'unblocktoken' => array(
-                                       ApiBase::PROP_TYPE => 'string',
-                                       ApiBase::PROP_NULLABLE => true
-                               ),
                                'id' => array(
                                        ApiBase::PROP_TYPE => 'integer',
                                        ApiBase::PROP_NULLABLE => true