Page Menu
Home
WickedGov Phorge
Search
Configure Global Search
Log In
Files
F5936973
UnblockAutopromote.php
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Size
2 KB
Referenced Files
None
Subscribers
None
UnblockAutopromote.php
View Options
<?php
namespace
MediaWiki\Extension\AbuseFilter\Api
;
use
MediaWiki\Api\ApiBase
;
use
MediaWiki\Api\ApiMain
;
use
MediaWiki\Extension\AbuseFilter\BlockAutopromoteStore
;
use
MediaWiki\ParamValidator\TypeDef\UserDef
;
use
Wikimedia\ParamValidator\ParamValidator
;
class
UnblockAutopromote
extends
ApiBase
{
/** @var BlockAutopromoteStore */
private
$afBlockAutopromoteStore
;
/**
* @param ApiMain $main
* @param string $action
* @param BlockAutopromoteStore $afBlockAutopromoteStore
*/
public
function
__construct
(
ApiMain
$main
,
$action
,
BlockAutopromoteStore
$afBlockAutopromoteStore
)
{
parent
::
__construct
(
$main
,
$action
);
$this
->
afBlockAutopromoteStore
=
$afBlockAutopromoteStore
;
}
/**
* @inheritDoc
*/
public
function
execute
()
{
$this
->
checkUserRightsAny
(
'abusefilter-modify'
);
$params
=
$this
->
extractRequestParams
();
$target
=
$params
[
'user'
];
$block
=
$this
->
getAuthority
()->
getBlock
();
if
(
$block
&&
$block
->
isSitewide
()
)
{
$this
->
dieBlocked
(
$block
);
}
$msg
=
$this
->
msg
(
'abusefilter-tools-restoreautopromote'
)->
inContentLanguage
()->
text
();
$res
=
$this
->
afBlockAutopromoteStore
->
unblockAutopromote
(
$target
,
$this
->
getUser
(),
$msg
);
if
(
!
$res
)
{
$this
->
dieWithError
(
[
'abusefilter-reautoconfirm-none'
,
$target
->
getName
()
],
'notsuspended'
);
}
$finalResult
=
[
'user'
=>
$target
->
getName
()
];
$this
->
getResult
()->
addValue
(
null
,
$this
->
getModuleName
(),
$finalResult
);
}
/**
* @codeCoverageIgnore Merely declarative
* @inheritDoc
*/
public
function
mustBePosted
()
{
return
true
;
}
/**
* @codeCoverageIgnore Merely declarative
* @inheritDoc
*/
public
function
isWriteMode
()
{
return
true
;
}
/**
* @codeCoverageIgnore Merely declarative
* @inheritDoc
*/
public
function
getAllowedParams
()
{
return
[
'user'
=>
[
ParamValidator
::
PARAM_TYPE
=>
'user'
,
ParamValidator
::
PARAM_REQUIRED
=>
true
,
UserDef
::
PARAM_RETURN_OBJECT
=>
true
,
UserDef
::
PARAM_ALLOWED_USER_TYPES
=>
[
'name'
],
],
'token'
=>
null
,
];
}
/**
* @codeCoverageIgnore Merely declarative
* @inheritDoc
*/
public
function
needsToken
()
{
return
'csrf'
;
}
/**
* @codeCoverageIgnore Merely declarative
* @inheritDoc
*/
protected
function
getExamplesMessages
()
{
return
[
'action=abusefilterunblockautopromote&user=Example&token=123ABC'
=>
'apihelp-abusefilterunblockautopromote-example-1'
,
];
}
}
File Metadata
Details
Attached
Mime Type
text/x-php
Expires
Oct 2 2026, 15:44 (6 w, 5 d ago)
Storage Engine
local-disk
Storage Format
Raw Data
Storage Handle
6a/93/3b3e113981a26a85cc27b0bba189
Default Alt Text
UnblockAutopromote.php (2 KB)
Attached To
Mode
rMWPROD MediaWiki Production
Attached
Detach File
Event Timeline
Log In to Comment