MediaWiki  1.34.0
MediaWiki\Block\SystemBlock Class Reference

System blocks are temporary blocks that are created on enforcement (e.g. More...

Inheritance diagram for MediaWiki\Block\SystemBlock:
Collaboration diagram for MediaWiki\Block\SystemBlock:

Public Member Functions

 __construct (array $options=[])
 Create a new block with specified parameters on a user, IP or IP range. More...
 
 appliesToPasswordReset ()
 Check if the block prevents a user from resetting their password.
Since
1.33
Returns
bool The block blocks password reset
More...
 
 getPermissionsError (IContextSource $context)
 Get the key and parameters for the corresponding error message.
Since
1.22
Parameters
IContextSource$context
Returns
array
More...
 
 getSystemBlockType ()
 Get the system block type, if any. More...
 
- Public Member Functions inherited from MediaWiki\Block\AbstractBlock
 appliesToNamespace ( $ns)
 Checks if a block applies to a particular namespace. More...
 
 appliesToPage ( $pageId)
 Checks if a block applies to a particular page. More...
 
 appliesToRight ( $right)
 Determine whether the block prevents a given right. More...
 
 appliesToTitle (Title $title)
 Checks if a block applies to a particular title. More...
 
 appliesToUsertalk (Title $usertalk=null)
 Determine whether the block allows the user to edit their own user talk page. More...
 
 getBlocker ()
 Get the user who implemented this block. More...
 
 getBlockErrorParams (IContextSource $context)
 Get block information used in different block error messages. More...
 
 getBy ()
 Get the user id of the blocking sysop. More...
 
 getByName ()
 Get the username of the blocking sysop. More...
 
 getExpiry ()
 Get the block expiry time. More...
 
 getHideName ()
 Get whether the block hides the target's username. More...
 
 getId ()
 Get the block ID. More...
 
 getReason ()
 Get the reason given for creating the block. More...
 
 getTarget ()
 Get the target for this particular block. More...
 
 getTargetAndType ()
 Get the target and target type for this particular block. More...
 
 getTimestamp ()
 Get the timestamp indicating when the block was created. More...
 
 getType ()
 Get the type of target for this particular block. More...
 
 isCreateAccountBlocked ( $x=null)
 Get or set the flag indicating whether this block blocks the target from creating an account. More...
 
 isEmailBlocked ( $x=null)
 Get or set the flag indicating whether this block blocks the target from sending emails. More...
 
 isSitewide ( $x=null)
 Indicates that the block is a sitewide block. More...
 
 isUsertalkEditAllowed ( $x=null)
 Get or set the flag indicating whether this block blocks the target from editing their own user talk page. More...
 
 prevents ( $action, $x=null)
 Get/set whether the block prevents a given action. More...
 
 setBlocker ( $user)
 Set the user who implemented (or will implement) this block. More...
 
 setExpiry ( $expiry)
 Set the block expiry time. More...
 
 setHideName ( $hideName)
 Set whether ths block hides the target's username. More...
 
 setReason ( $reason)
 Set the reason for creating the block. More...
 
 setTarget ( $target)
 Set the target for this block, and update $this->type accordingly. More...
 
 setTimestamp ( $timestamp)
 Set the timestamp indicating when the block was created. More...
 
 shouldTrackWithCookie ( $isAnon)
 Check if the block should be tracked with a cookie. More...
 

Private Attributes

string null $systemBlockType
 

Additional Inherited Members

- Static Public Member Functions inherited from MediaWiki\Block\AbstractBlock
static parseTarget ( $target)
 From an existing block, get the target and the type of target. More...
 
- Public Attributes inherited from MediaWiki\Block\AbstractBlock
string $mExpiry = ''
 
bool $mHideName = false
 
string $mReason
 
string $mTimestamp
 
const TYPE_AUTO = 4
 
const TYPE_ID = 5
 
const TYPE_IP = 2
 
const TYPE_RANGE = 3
 
const TYPE_USER = 1
 
- Protected Attributes inherited from MediaWiki\Block\AbstractBlock
bool $allowUsertalk = false
 
bool $blockCreateAccount = false
 
User $blocker
 
bool $isSitewide = true
 
bool $mBlockEmail = false
 
User string $target
 
int $type
 AbstractBlock::TYPE_ constant. More...
 

Detailed Description

System blocks are temporary blocks that are created on enforcement (e.g.

from IP blacklists) and are not saved to the database. The target of a system block is an IP address. System blocks do not give rise to autoblocks and are not tracked with cookies.

Since
1.34

Definition at line 35 of file SystemBlock.php.

Constructor & Destructor Documentation

◆ __construct()

MediaWiki\Block\SystemBlock::__construct ( array  $options = [])

Create a new block with specified parameters on a user, IP or IP range.

Parameters
array$optionsParameters of the block, with options supported by AbstractBlock::__construct, and also:
  • systemBlock: (string) Indicate that this block is automatically created by MediaWiki rather than being stored in the database. Value is a string to return from self::getSystemBlockType().

Reimplemented from MediaWiki\Block\AbstractBlock.

Definition at line 48 of file SystemBlock.php.

Member Function Documentation

◆ appliesToPasswordReset()

MediaWiki\Block\SystemBlock::appliesToPasswordReset ( )

Check if the block prevents a user from resetting their password.

Since
1.33
Returns
bool The block blocks password reset

Reimplemented from MediaWiki\Block\AbstractBlock.

Definition at line 93 of file SystemBlock.php.

References MediaWiki\Block\SystemBlock\getSystemBlockType(), and MediaWiki\Block\AbstractBlock\isCreateAccountBlocked().

◆ getPermissionsError()

MediaWiki\Block\SystemBlock::getPermissionsError ( IContextSource  $context)

Get the key and parameters for the corresponding error message.

Since
1.22
Parameters
IContextSource$context
Returns
array

Reimplemented from MediaWiki\Block\AbstractBlock.

Definition at line 77 of file SystemBlock.php.

References MediaWiki\Block\AbstractBlock\getBlockErrorParams(), and MediaWiki\Block\SystemBlock\getSystemBlockType().

◆ getSystemBlockType()

MediaWiki\Block\SystemBlock::getSystemBlockType ( )

Get the system block type, if any.

A SystemBlock can have the following types:

  • 'proxy': the IP is blacklisted in $wgProxyList
  • 'dnsbl': the IP is associated with a blacklisted domain in $wgDnsBlacklistUrls
  • 'wgSoftBlockRanges': the IP is covered by $wgSoftBlockRanges
  • 'global-block': for backwards compatability with the UserIsBlockedGlobally hook
Since
1.29
Returns
string|null

Definition at line 70 of file SystemBlock.php.

References MediaWiki\Block\SystemBlock\$systemBlockType.

Referenced by MediaWiki\Block\SystemBlock\appliesToPasswordReset(), and MediaWiki\Block\SystemBlock\getPermissionsError().

Member Data Documentation

◆ $systemBlockType

string null MediaWiki\Block\SystemBlock::$systemBlockType
private

Definition at line 37 of file SystemBlock.php.

Referenced by MediaWiki\Block\SystemBlock\getSystemBlockType().


The documentation for this class was generated from the following file: