* of success. If it fails, the result will specify the nature of the error.
*/
public function execute() {
- global $wgContLang;
-
$this->checkUserRightsAny( 'block' );
$user = $this->getUser();
}
}
+ if ( $params['tags'] ) {
+ $ableToTag = ChangeTags::canAddTagsAccompanyingChange( $params['tags'], $user );
+ if ( !$ableToTag->isOK() ) {
+ $this->dieStatus( $ableToTag );
+ }
+ }
+
if ( $params['hidename'] && !$user->isAllowed( 'hideuser' ) ) {
$this->dieWithError( 'apierror-canthide' );
}
'Reblock' => $params['reblock'],
'Watch' => $params['watchuser'],
'Confirm' => true,
+ 'Tags' => $params['tags'],
];
$retval = SpecialBlock::processForm( $data, $this->getContext() );
$block = Block::newFromTarget( $target, null, true );
if ( $block instanceof Block ) {
- $res['expiry'] = $wgContLang->formatExpiry( $block->mExpiry, TS_ISO_8601, 'infinite' );
+ $res['expiry'] = ApiResult::formatExpiry( $block->mExpiry, 'infinite' );
$res['id'] = $block->getId();
} else {
# should be unreachable
'allowusertalk' => false,
'reblock' => false,
'watchuser' => false,
+ 'tags' => [
+ ApiBase::PARAM_TYPE => 'tags',
+ ApiBase::PARAM_ISMULTI => true,
+ ],
];
}