47 if ( !
$user->isAllowed(
'block' ) ) {
51 # bug 15810: blocked admins should have limited access here
52 if (
$user->isBlocked() ) {
65 $target = User::newFromName(
$params[
'user'] );
68 if ( $target instanceof
User &&
69 ( $target->isAnon() || !User::isUsableName( $target->getName() ) )
74 if (
$params[
'hidename'] && !
$user->isAllowed(
'hideuser' ) ) {
82 'PreviousTarget' =>
$params[
'user'],
90 'HardBlock' => !
$params[
'anononly'],
91 'CreateAccount' =>
$params[
'nocreate'],
92 'AutoBlock' =>
$params[
'autoblock'],
93 'DisableEmail' =>
$params[
'noemail'],
94 'HideUser' =>
$params[
'hidename'],
95 'DisableUTEdit' => !
$params[
'allowusertalk'],
96 'Reblock' =>
$params[
'reblock'],
97 'Watch' =>
$params[
'watchuser'],
109 $res[
'userID'] = $target instanceof
User ? $target->
getId() : 0;
112 if ( $block instanceof
Block ) {
114 $res[
'id'] = $block->getId();
116 # should be unreachable
151 'autoblock' =>
false,
154 'allowusertalk' =>
false,
156 'watchuser' =>
false,
167 'action=block&user=192.0.2.5&expiry=3%20days&reason=First%20strike&token=123ABC'
168 =>
'apihelp-block-example-ip-simple',
169 'action=block&user=Vandal&expiry=never&reason=Vandalism&nocreate=&autoblock=&noemail=&token=123ABC'
170 =>
'apihelp-block-example-user-complex',
176 return 'https://www.mediawiki.org/wiki/API:Block';
This abstract class implements many basic API functions, and is the base of all API classes.
const PARAM_REQUIRED
(boolean) Is the parameter required?
const PARAM_TYPE
(string|string[]) Either an array of allowed value strings, or a string type as described below.
parseMsg( $error)
Return the error message related to a certain array.
extractRequestParams( $parseLimit=true)
Using getAllowedParams(), this function makes an array of the values provided by the user,...
dieUsageMsg( $error)
Output the error message related to a certain array.
getResult()
Get the result object.
getModuleName()
Get the name of the module being executed by this instance.
dieUsage( $description, $errorCode, $httpRespCode=0, $extradata=null)
Throw a UsageException, which will (if uncaught) call the main module's error handler and die with an...
API module that facilitates the blocking of users.
needsToken()
Returns the token type this module requires in order to execute.
getExamplesMessages()
Returns usage examples for this module.
isWriteMode()
Indicates whether this module requires write mode.
mustBePosted()
Indicates whether this module must be called with a POST request.
getAllowedParams()
Returns an array of allowed parameters (parameter name) => (default value) or (parameter name) => (ar...
execute()
Blocks the user specified in the parameters for the given expiry, with the given reason,...
getHelpUrls()
Return links to more detailed help pages about the module.
static getBlockInfo(Block $block)
Get basic info about a given block.
static newFromTarget( $specificTarget, $vagueTarget=null, $fromMaster=false)
Given a target and the target's type, get an existing Block object if possible.
getUser()
Get the User object.
getContext()
Get the base IContextSource object.
static processForm(array $data, IContextSource $context)
Given the form data, actually implement a block.
static getTargetAndType( $par, WebRequest $request=null)
Determine the target of the block, and the type of target.
static checkUnblockSelf( $user, User $performer)
bug 15810: blocked admins should not be able to block/unblock others, and probably shouldn't be able ...
static canBlockEmail( $user)
Can we do an email block?
The User object encapsulates all of the user-specific settings (user_id, name, rights,...
getId()
Get the user's ID.
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
this class mediates it Skin Encapsulates a look and feel for the wiki All of the functions that render HTML and make choices about how to render it are here and are called from various other places when and is meant to be subclassed with other skins that may override some of its functions The User object contains a reference to a and so rather than having a global skin object we just rely on the global User and get the skin with $wgUser and also has some character encoding functions and other locale stuff The current user interface language is instantiated as and the local content language as $wgContLang
when a variable name is used in a it is silently declared as a new local masking the global
this hook is for auditing only RecentChangesLinked and Watchlist RecentChangesLinked and Watchlist e g Watchlist 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
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 local account $user
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 local account incomplete not yet checked for validity & $retval
null means default in associative array with keys and values unescaped Should be merged with default with a value of false meaning to suppress the attribute in associative array with keys and values unescaped noclasses just before the function returns a value If you return true
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
const TS_ISO_8601
ISO 8601 format with no timezone: 1986-02-09T20:00:00Z.