MediaWiki REL1_39
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.
 
 appliesToPasswordReset ()
 Check if the block prevents a user from resetting their password.
Since
1.33
Returns
bool The block blocks password reset

 
 getBlocker ()
 Get the user who applied this block.
Returns
UserIdentity|null user identity or null. May be an external user.

 
 getBy ( $wikiId=self::LOCAL)
 Get the user id of the blocking sysop.
Parameters
string | false$wikiId(since 1.38)
Returns
int (0 for foreign users)

 
 getByName ()
 Get the username of the blocking sysop.
Returns
string

 
 getIdentifier ( $wikiId=self::LOCAL)
 Get the information that identifies this block, such that a user could look up everything that can be found about this block.Typically a scalar ID (integer or string), but can also return a list of IDs, or an associative array encoding a composite ID. Must be safe to serialize as JSON.
Parameters
string | false$wikiId(since 1.38)
Returns
mixed Identifying information

 
 getSystemBlockType ()
 Get the system block type, if any.
 
- Public Member Functions inherited from MediaWiki\Block\AbstractBlock
 appliesToNamespace ( $ns)
 Checks if a block applies to a particular namespace.
 
 appliesToPage ( $pageId)
 Checks if a block applies to a particular page.
 
 appliesToRight ( $right)
 Determine whether the block prevents a given right.
 
 appliesToTitle (Title $title)
 Checks if a block applies to a particular title.
 
 appliesToUsertalk (Title $usertalk=null)
 Determine whether the block allows the user to edit their own user talk page.
 
 getExpiry ()
 Get the block expiry time.
 
 getHideName ()
 Get whether the block hides the target's username.
 
 getId ( $wikiId=self::LOCAL)
 Get the block ID.
Parameters
string | false$wikiId(since 1.38)
Returns
?int

 
 getPermissionsError (IContextSource $context)
 Get the key and parameters for the corresponding error message.
 
 getReason ()
 Get the reason given for creating the block, as a string.
 
 getReasonComment ()
 Get the reason for creating the block.
 
 getTargetName ()
 
 getTargetUserIdentity ()
 
 getTimestamp ()
 Get the timestamp indicating when the block was created.
 
 getType ()
 Get the type of target for this particular block.
 
 getWikiId ()
 
 isBlocking ( $target)
 
 isCreateAccountBlocked ( $x=null)
 Get or set the flag indicating whether this block blocks the target from creating an account.
 
 isEmailBlocked ( $x=null)
 Get or set the flag indicating whether this block blocks the target from sending emails.
 
 isHardblock ( $x=null)
 Get/set whether the block is a hardblock (affects logged-in users on a given IP/range)
 
 isSitewide ( $x=null)
 Indicates that the block is a sitewide block.
 
 isUsertalkEditAllowed ( $x=null)
 Get or set the flag indicating whether this block blocks the target from editing their own user talk page.
 
 setExpiry ( $expiry)
 Set the block expiry time.
 
 setHideName ( $hideName)
 Set whether ths block hides the target's username.
 
 setReason ( $reason)
 Set the reason for creating the block.
 
 setTarget ( $target)
 Set the target for this block, and update $this->type accordingly.
 
 setTimestamp ( $timestamp)
 Set the timestamp indicating when the block was created.
 
- Public Member Functions inherited from MediaWiki\Block\Block
 isCreateAccountBlocked ()
 Get the flag indicating whether this block blocks the target from creating an account.
 
 isHardblock ()
 Returns whether the block is a hardblock (affects logged-in users on a given IP/range)
 
 isSitewide ()
 Indicates that the block is a sitewide block.
 
- Public Member Functions inherited from MediaWiki\DAO\WikiAwareEntity
 assertWiki ( $wikiId)
 Throws if $wikiId is different from the return value of getWikiId().
 

Additional Inherited Members

- Public Attributes inherited from MediaWiki\Block\Block
const BLOCK_TYPES
 Map block types to strings, to allow convenient logging.
 
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
 
bool $isHardblock
 
bool $isSitewide = true
 
bool $mBlockEmail = false
 
string $mExpiry = ''
 
bool $mHideName = false
 
string $mTimestamp = ''
 
CommentStoreComment $reason
 
UserIdentity string null $target
 
int null $type
 AbstractBlock::TYPE_ constant.
 
string false $wikiId
 

Detailed Description

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

from IP lists) 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 84 of file SystemBlock.php.

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

◆ getBlocker()

MediaWiki\Block\SystemBlock::getBlocker ( )

Get the user who applied this block.

Returns
UserIdentity|null user identity or null. May be an external user.

Implements MediaWiki\Block\Block.

Definition at line 117 of file SystemBlock.php.

◆ getBy()

MediaWiki\Block\SystemBlock::getBy ( $wikiId = self::LOCAL)

Get the user id of the blocking sysop.

Parameters
string | false$wikiId(since 1.38)
Returns
int (0 for foreign users)

Reimplemented from MediaWiki\Block\AbstractBlock.

Definition at line 102 of file SystemBlock.php.

◆ getByName()

MediaWiki\Block\SystemBlock::getByName ( )

Get the username of the blocking sysop.

Returns
string

Reimplemented from MediaWiki\Block\AbstractBlock.

Definition at line 110 of file SystemBlock.php.

◆ getIdentifier()

MediaWiki\Block\SystemBlock::getIdentifier ( $wikiId = self::LOCAL)

Get the information that identifies this block, such that a user could look up everything that can be found about this block.Typically a scalar ID (integer or string), but can also return a list of IDs, or an associative array encoding a composite ID. Must be safe to serialize as JSON.

Parameters
string | false$wikiId(since 1.38)
Returns
mixed Identifying information

Implements MediaWiki\Block\Block.

Definition at line 77 of file SystemBlock.php.

References 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 listed in $wgProxyList
  • 'dnsbl': the IP is associated with a listed domain in $wgDnsBlacklistUrls
  • 'wgSoftBlockRanges': the IP is covered by $wgSoftBlockRanges
  • 'global-block': for backwards compatibility with the UserIsBlockedGlobally hook
Since
1.29
Returns
string|null

Definition at line 70 of file SystemBlock.php.

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


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