X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2Fapi%2FApiBlock.php;h=366a6df98f46d3255c3323bc55b5442da0b2b601;hb=ea8961d7ee57c68f57f5df27876bb04a96f5ff84;hp=8577ad28b9228b329e0d66ec90137f893dedd082;hpb=3287201b673c6e52c04e9f8771c0e71d1a617910;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/api/ApiBlock.php b/includes/api/ApiBlock.php index 8577ad28b9..366a6df98f 100644 --- a/includes/api/ApiBlock.php +++ b/includes/api/ApiBlock.php @@ -67,12 +67,12 @@ class ApiBlock extends ApiBase { $params['user'] = $username; } } else { - $target = User::newFromName( $params['user'] ); + list( $target, $type ) = SpecialBlock::getTargetAndType( $params['user'] ); // T40633 - 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() ) ) + if ( $type === Block::TYPE_USER && + ( $target->isAnon() /* doesn't exist */ || !User::isUsableName( $params['user'] ) ) ) { $this->dieWithError( [ 'nosuchusershort', $params['user'] ], 'nosuchuser' ); } @@ -193,6 +193,6 @@ class ApiBlock extends ApiBase { } public function getHelpUrls() { - return 'https://www.mediawiki.org/wiki/API:Block'; + return 'https://www.mediawiki.org/wiki/Special:MyLanguage/API:Block'; } }