Go to the documentation of this file.
49 # T17810: blocked admins should have limited access here
50 if (
$user->isBlocked() ) {
61 if (
$params[
'userid'] !==
null ) {
74 if ( $target instanceof
User &&
83 if ( !$ableToTag->isOK() ) {
88 if (
$params[
'hidename'] && !
$user->isAllowed(
'hideuser' ) ) {
96 'PreviousTarget' =>
$params[
'user'],
104 'HardBlock' => !
$params[
'anononly'],
105 'CreateAccount' =>
$params[
'nocreate'],
106 'AutoBlock' =>
$params[
'autoblock'],
107 'DisableEmail' =>
$params[
'noemail'],
108 'HideUser' =>
$params[
'hidename'],
109 'DisableUTEdit' => !
$params[
'allowusertalk'],
110 'Reblock' =>
$params[
'reblock'],
111 'Watch' =>
$params[
'watchuser'],
123 $res[
'userID'] = $target instanceof
User ? $target->
getId() : 0;
126 if ( $block instanceof
Block ) {
128 $res[
'id'] = $block->getId();
130 # should be unreachable
167 'autoblock' =>
false,
170 'allowusertalk' =>
false,
172 'watchuser' =>
false,
187 'action=block&user=192.0.2.5&expiry=3%20days&reason=First%20strike&token=123ABC'
188 =>
'apihelp-block-example-ip-simple',
189 'action=block&user=Vandal&expiry=never&reason=Vandalism&nocreate=&autoblock=&noemail=&token=123ABC'
190 =>
'apihelp-block-example-user-complex',
196 return 'https://www.mediawiki.org/wiki/Special:MyLanguage/API:Block';
getContext()
Get the base IContextSource object.
getId()
Get the user's ID.
getExamplesMessages()
Returns usage examples for this module.
dieWithError( $msg, $code=null, $data=null, $httpCode=null)
Abort execution with an error.
static processForm(array $data, IContextSource $context)
Given the form data, actually implement a block.
static canBlockEmail( $user)
Can we do an email block?
mustBePosted()
Indicates whether this module must be called with a POST request.
const PARAM_TYPE
(string|string[]) Either an array of allowed value strings, or a string type as described below.
getResult()
Get the result object.
this hook is for auditing only RecentChangesLinked and Watchlist RecentChangesLinked and Watchlist Do not use this to implement individual filters if they are compatible with the ChangesListFilter and ChangesListFilterGroup structure use sub classes of those in conjunction with the ChangesListSpecialPageStructuredFilters hook This hook can be used to implement filters that do not implement that or custom behavior that is not an individual filter e g Watchlist and Watchlist you will want to construct new ChangesListBooleanFilter or ChangesListStringOptionsFilter objects When constructing you specify which group they belong to You can reuse existing or create your you must register them with $special registerFilterGroup removed from all revisions and log entries to which it was applied This gives extensions a chance to take it off their books as the deletion has already been partly carried out by this point or something similar the user will be unable to create the tag set $status
isWriteMode()
Indicates whether this module requires write mode.
please add to it if you re going to add events to the MediaWiki code where normally authentication against an external auth plugin would be creating a account $user
checkUserRightsAny( $rights, $user=null)
Helper function for permission-denied errors.
static newFromTarget( $specificTarget, $vagueTarget=null, $fromMaster=false)
Given a target and the target's type, get an existing Block object if possible.
static newFromName( $name, $validate='valid')
Static factory method for creation from username.
getUser()
Get the User object.
needsToken()
Returns the token type this module requires in order to execute.
injection txt This is an overview of how MediaWiki makes use of dependency injection The design described here grew from the discussion of RFC T384 The term dependency this means that anything an object needs to operate should be injected from the the object itself should only know narrow no concrete implementation of the logic it relies on The requirement to inject everything typically results in an architecture that based on two main types of and essentially stateless service objects that use other service objects to operate on the value objects As of the beginning MediaWiki is only starting to use the DI approach Much of the code still relies on global state or direct resulting in a highly cyclical dependency which acts as the top level factory for services in MediaWiki which can be used to gain access to default instances of various services MediaWikiServices however also allows new services to be defined and default services to be redefined Services are defined or redefined by providing a callback the instantiator that will return a new instance of the service When it will create an instance of MediaWikiServices and populate it with the services defined in the files listed by thereby bootstrapping the DI framework Per $wgServiceWiringFiles lists includes ServiceWiring php
This abstract class implements many basic API functions, and is the base of all API classes.
API module that facilitates the blocking of users.
deferred txt A few of the database updates required by various functions here can be deferred until after the result page is displayed to the user For updating the view updating the linked to tables after a etc PHP does not yet have any way to tell the server to actually return and disconnect while still running these but it might have such a feature in the future We handle these by creating a deferred update object and putting those objects on a global list
extractRequestParams( $parseLimit=true)
Using getAllowedParams(), this function makes an array of the values provided by the user,...
static whoIs( $id)
Get the username corresponding to a given user ID.
please add to it if you re going to add events to the MediaWiki code where normally authentication against an external auth plugin would be creating a account incomplete not yet checked for validity & $retval
getHelpUrls()
Return links to more detailed help pages about the module.
requireOnlyOneParameter( $params, $required)
Die if none or more than one of a certain set of parameters is set and not false.
execute()
Blocks the user specified in the parameters for the given expiry, with the given reason,...
dieStatus(StatusValue $status)
Throw an ApiUsageException based on the Status object.
getModuleName()
Get the name of the module being executed by this instance.
const PARAM_ISMULTI
(boolean) Accept multiple pipe-separated values for this parameter (e.g.
static checkUnblockSelf( $user, User $performer)
T17810: blocked admins should not be able to block/unblock others, and probably shouldn't be able to ...
static formatExpiry( $expiry, $infinity='infinity')
Format an expiry timestamp for API output.
static getTargetAndType( $par, WebRequest $request=null)
Determine the target of the block, and the type of target.
static isUsableName( $name)
Usernames which fail to pass this function will be blocked from user login and new account registrati...
getAllowedParams()
Returns an array of allowed parameters (parameter name) => (default value) or (parameter name) => (ar...
The User object encapsulates all of the user-specific settings (user_id, name, rights,...
this hook is for auditing only or null if authentication failed before getting that far $username
errorArrayToStatus(array $errors, User $user=null)
Turn an array of message keys or key+param arrays into a Status.
static getBlockInfo(Block $block)
Get basic info about a given block.