MediaWiki master
|
Inherits MediaWiki\Block\Block.
Inherited by MediaWiki\Block\CompositeBlock, MediaWiki\Block\DatabaseBlock, and MediaWiki\Block\SystemBlock.
Public Member Functions | ||||
__construct (array $options=[]) | ||||
Create a new block with specified parameters on a user, IP or IP range. | ||||
appliesToNamespace ( $ns) | ||||
Checks if a block applies to a particular namespace. | ||||
appliesToPage ( $pageId) | ||||
Checks if a block applies to a particular page. | ||||
appliesToPasswordReset () | ||||
Check if the block prevents a user from resetting their password. | ||||
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. | ||||
getBy ( $wikiId=self::LOCAL) | ||||
Get the user id of the blocking sysop. | ||||
getByName () | ||||
Get the username of the blocking sysop. | ||||
getExpiry () | ||||
Get the block expiry time. | ||||
getHideName () | ||||
Get whether the block hides the target's username. | ||||
getId ( $wikiId=self::LOCAL) | ||||
Get the block ID.
| ||||
getReasonComment () | ||||
Get the reason for creating the block. | ||||
getRedactedTarget () | ||||
Get the target, with the IP address hidden behind an AutoBlockTarget if the block is an autoblock. | ||||
getTarget () | ||||
Get the target as an object. | ||||
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 hard block (affects logged-in users on a given IP/range). | ||||
isIndefinite () | ||||
Is the block indefinite (with no fixed expiry)?
| ||||
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 the block hides the target's username. | ||||
setReason ( $reason) | ||||
Set the reason for creating the block. | ||||
setTarget ( $target) | ||||
Set the target for this block. | ||||
setTimestamp ( $timestamp) | ||||
Set the timestamp indicating when the block was created. | ||||
toArray () | ||||
![]() | ||||
getBlocker () | ||||
Get the user who applied this block. | ||||
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. | ||||
isCreateAccountBlocked () | ||||
Get the flag indicating whether this block blocks the target from creating an account. | ||||
isHardblock () | ||||
Get whether the block is a hard block (affects logged-in users on a given IP/range). | ||||
isSitewide () | ||||
Get whether the block is a sitewide block. | ||||
![]() | ||||
assertWiki ( $wikiId) | ||||
Throws if $wikiId is different from the return value of getWikiId(). | ||||
Protected Attributes | |
bool | $allowUsertalk = false |
bool | $blockCreateAccount = false |
bool | $blockEmail = false |
string | $expiry = '' |
bool | $hideName = false |
bool | $isHardblock |
bool | $isSitewide = true |
CommentStoreComment | $reason |
BlockTarget null | $target |
string | $timestamp = '' |
string false | $wikiId |
Additional Inherited Members | |
![]() | |
const | BLOCK_TYPES |
Map block types to strings, to allow convenient logging. | |
const | TYPE_AUTO = 4 |
const | TYPE_IP = 2 |
const | TYPE_RANGE = 3 |
const | TYPE_USER = 1 |
Definition at line 38 of file AbstractBlock.php.
MediaWiki\Block\AbstractBlock::__construct | ( | array | $options = [] | ) |
Create a new block with specified parameters on a user, IP or IP range.
array | $options | Parameters of the block, with supported options:
|
Reimplemented in MediaWiki\Block\CompositeBlock, MediaWiki\Block\DatabaseBlock, and MediaWiki\Block\SystemBlock.
Definition at line 92 of file AbstractBlock.php.
References MediaWiki\Block\Block\isHardblock(), MediaWiki\Block\AbstractBlock\setHideName(), MediaWiki\Block\AbstractBlock\setReason(), MediaWiki\Block\AbstractBlock\setTarget(), MediaWiki\Block\AbstractBlock\setTimestamp(), and wfTimestamp().
MediaWiki\Block\AbstractBlock::appliesToNamespace | ( | $ns | ) |
Checks if a block applies to a particular namespace.
int | $ns |
Reimplemented in MediaWiki\Block\CompositeBlock, and MediaWiki\Block\DatabaseBlock.
Definition at line 526 of file AbstractBlock.php.
MediaWiki\Block\AbstractBlock::appliesToPage | ( | $pageId | ) |
Checks if a block applies to a particular page.
This check does not consider whether $this->isUsertalkEditAllowed
returns false, as the identity of the user making the hypothetical edit isn't known here (particularly in the case of IP hard blocks, range blocks, and auto-blocks).
int | $pageId |
Reimplemented in MediaWiki\Block\CompositeBlock, and MediaWiki\Block\DatabaseBlock.
Definition at line 543 of file AbstractBlock.php.
MediaWiki\Block\AbstractBlock::appliesToPasswordReset | ( | ) |
Check if the block prevents a user from resetting their password.
Reimplemented in MediaWiki\Block\CompositeBlock, and MediaWiki\Block\SystemBlock.
Definition at line 553 of file AbstractBlock.php.
MediaWiki\Block\AbstractBlock::appliesToRight | ( | $right | ) |
Determine whether the block prevents a given right.
A right may be allowed or disallowed by default, or determined from a property on the block object. For certain rights, the property may be overridden according to global configs.
string | $right |
Reimplemented in MediaWiki\Block\CompositeBlock, and MediaWiki\Block\DatabaseBlock.
Definition at line 272 of file AbstractBlock.php.
MediaWiki\Block\AbstractBlock::appliesToTitle | ( | Title | $title | ) |
Checks if a block applies to a particular title.
This check does not consider whether $this->isUsertalkEditAllowed
returns false, as the identity of the user making the hypothetical edit isn't known here (particularly in the case of IP hard blocks, range blocks, and auto-blocks).
Title | $title |
Reimplemented in MediaWiki\Block\CompositeBlock, and MediaWiki\Block\DatabaseBlock.
Definition at line 514 of file AbstractBlock.php.
MediaWiki\Block\AbstractBlock::appliesToUsertalk | ( | ?Title | $usertalk = null | ) |
Determine whether the block allows the user to edit their own user talk page.
This is done separately from AbstractBlock::appliesToRight because there is no right for editing one's own user talk page and because the user's talk page needs to be passed into the block object, which is unaware of the user.
The bl_allow_usertalk flag (which corresponds to the property allowUsertalk) is used on sitewide blocks and partial blocks that contain a namespace restriction on the user talk namespace, but do not contain a page restriction on the user's talk page. For all other (i.e. most) partial blocks, the flag is ignored, and the user can always edit their user talk page unless there is a page restriction on their user talk page, in which case they can never edit it. (Ideally the flag would be stored as null in these cases, but the database field isn't nullable.)
This method does not validate that the passed in talk page belongs to the block target since the target (an IP) might not be the same as the user's talk page (if they are logged in).
Title | null | $usertalk | The user's user talk page. If null, and if the target is a User, the target's userpage is used |
Reimplemented in MediaWiki\Block\CompositeBlock.
Definition at line 464 of file AbstractBlock.php.
References NS_USER_TALK.
|
abstract |
Get the user id of the blocking sysop.
string | false | $wikiId | (since 1.38) |
Reimplemented in MediaWiki\Block\CompositeBlock, MediaWiki\Block\DatabaseBlock, and MediaWiki\Block\SystemBlock.
|
abstract |
Get the username of the blocking sysop.
Reimplemented in MediaWiki\Block\CompositeBlock, MediaWiki\Block\DatabaseBlock, and MediaWiki\Block\SystemBlock.
MediaWiki\Block\AbstractBlock::getExpiry | ( | ) |
Get the block expiry time.
Implements MediaWiki\Block\Block.
Reimplemented in MediaWiki\Block\CompositeBlock.
Definition at line 367 of file AbstractBlock.php.
Referenced by MediaWiki\Block\DatabaseBlockStore\doAutoblock(), MediaWiki\Block\DatabaseBlock\equals(), MediaWiki\Block\DatabaseBlock\isExpired(), and MediaWiki\Block\DatabaseBlockStore\updateTimestamp().
MediaWiki\Block\AbstractBlock::getHideName | ( | ) |
Get whether the block hides the target's username.
Definition at line 173 of file AbstractBlock.php.
Referenced by MediaWiki\Block\DatabaseBlockStore\doAutoblock(), and MediaWiki\Block\DatabaseBlock\equals().
MediaWiki\Block\AbstractBlock::getId | ( | $wikiId = self::LOCAL | ) |
Get the block ID.
string | false | $wikiId | (since 1.38) |
Implements MediaWiki\Block\Block.
Reimplemented in MediaWiki\Block\DatabaseBlock.
Definition at line 142 of file AbstractBlock.php.
MediaWiki\Block\AbstractBlock::getReasonComment | ( | ) |
Get the reason for creating the block.
Implements MediaWiki\Block\Block.
Definition at line 153 of file AbstractBlock.php.
Referenced by MediaWiki\Block\DatabaseBlock\equals().
MediaWiki\Block\AbstractBlock::getRedactedTarget | ( | ) |
Get the target, with the IP address hidden behind an AutoBlockTarget if the block is an autoblock.
Implements MediaWiki\Block\Block.
Definition at line 308 of file AbstractBlock.php.
MediaWiki\Block\AbstractBlock::getTarget | ( | ) |
Get the target as an object.
For autoblocks this can be either the IP address or the autoblock ID depending on how the block was loaded. Use getRedactedTarget() to safely get a target for display.
Implements MediaWiki\Block\Block.
Definition at line 304 of file AbstractBlock.php.
Referenced by MediaWiki\Block\UnblockUser\__construct(), MediaWiki\Block\BlockUser\__construct(), and MediaWiki\Block\DatabaseBlockStore\updateTarget().
MediaWiki\Block\AbstractBlock::getTargetName | ( | ) |
Implements MediaWiki\Block\Block.
Definition at line 343 of file AbstractBlock.php.
MediaWiki\Block\AbstractBlock::getTargetUserIdentity | ( | ) |
Implements MediaWiki\Block\Block.
Definition at line 334 of file AbstractBlock.php.
Referenced by MediaWiki\Block\DatabaseBlockStore\insertBlock().
MediaWiki\Block\AbstractBlock::getTimestamp | ( | ) |
Get the timestamp indicating when the block was created.
Implements MediaWiki\Block\Block.
Reimplemented in MediaWiki\Block\CompositeBlock.
Definition at line 393 of file AbstractBlock.php.
Referenced by MediaWiki\Block\DatabaseBlockStore\insertBlock(), MediaWiki\Block\DatabaseBlockStore\updateBlock(), and MediaWiki\Block\DatabaseBlockStore\updateTimestamp().
MediaWiki\Block\AbstractBlock::getType | ( | ) |
Get the type of target for this particular block.
Implements MediaWiki\Block\Block.
Reimplemented in MediaWiki\Block\DatabaseBlock.
Definition at line 326 of file AbstractBlock.php.
MediaWiki\Block\AbstractBlock::getWikiId | ( | ) |
Implements MediaWiki\DAO\WikiAwareEntity.
Definition at line 433 of file AbstractBlock.php.
Referenced by MediaWiki\Block\DatabaseBlock\delete(), MediaWiki\Block\DatabaseBlock\doAutoblock(), MediaWiki\Block\DatabaseBlock\insert(), MediaWiki\Block\DatabaseBlock\update(), and MediaWiki\Block\DatabaseBlock\updateTimestamp().
MediaWiki\Block\AbstractBlock::isBlocking | ( | $target | ) |
BlockTarget | UserIdentity | string | $target |
Implements MediaWiki\Block\Block.
Definition at line 353 of file AbstractBlock.php.
MediaWiki\Block\AbstractBlock::isCreateAccountBlocked | ( | $x = null | ) |
Get or set the flag indicating whether this block blocks the target from creating an account.
(Note that the flag may be overridden depending on global configs.)
null | bool | $x | Value to set (if null, just get the property value) |
Definition at line 209 of file AbstractBlock.php.
Referenced by MediaWiki\Block\DatabaseBlockStore\doAutoblock(), and MediaWiki\Block\DatabaseBlock\equals().
MediaWiki\Block\AbstractBlock::isEmailBlocked | ( | $x = null | ) |
Get or set the flag indicating whether this block blocks the target from sending emails.
(Note that the flag may be overridden depending on global configs.)
null | bool | $x | Value to set (if null, just get the property value) |
Definition at line 222 of file AbstractBlock.php.
References wfSetVar().
Referenced by MediaWiki\Block\DatabaseBlock\__construct(), and MediaWiki\Block\DatabaseBlock\equals().
MediaWiki\Block\AbstractBlock::isHardblock | ( | $x = null | ) |
Get/set whether the block is a hard block (affects logged-in users on a given IP/range).
Note that temporary users are not considered logged-in here - they are always blocked by IP-address blocks.
Note that user blocks are always hard blocks, since the target is logged in by definition.
bool | null | $x |
Reimplemented in MediaWiki\Block\DatabaseBlock.
Definition at line 253 of file AbstractBlock.php.
MediaWiki\Block\AbstractBlock::isIndefinite | ( | ) |
Is the block indefinite (with no fixed expiry)?
Implements MediaWiki\Block\Block.
Definition at line 372 of file AbstractBlock.php.
MediaWiki\Block\AbstractBlock::isSitewide | ( | $x = null | ) |
Indicates that the block is a sitewide block.
This means the user is prohibited from editing any page on the site (other than their own talk page).
null | bool | $x |
Definition at line 196 of file AbstractBlock.php.
Referenced by MediaWiki\Block\DatabaseBlockStore\doAutoblock(), and MediaWiki\Block\DatabaseBlock\equals().
MediaWiki\Block\AbstractBlock::isUsertalkEditAllowed | ( | $x = null | ) |
Get or set the flag indicating whether this block blocks the target from editing their own user talk page.
(Note that the flag may be overridden depending on global configs.)
null | bool | $x | Value to set (if null, just get the property value) |
Definition at line 235 of file AbstractBlock.php.
References wfSetVar().
Referenced by MediaWiki\Block\DatabaseBlock\__construct(), MediaWiki\Block\DatabaseBlockStore\doAutoblock(), and MediaWiki\Block\DatabaseBlock\equals().
MediaWiki\Block\AbstractBlock::setExpiry | ( | $expiry | ) |
Set the block expiry time.
string | $expiry |
Definition at line 382 of file AbstractBlock.php.
Referenced by MediaWiki\Block\DatabaseBlock\__construct(), and MediaWiki\Block\DatabaseBlockStore\updateTimestamp().
MediaWiki\Block\AbstractBlock::setHideName | ( | $hideName | ) |
Set whether the block hides the target's username.
bool | $hideName | The block hides the username |
Definition at line 183 of file AbstractBlock.php.
Referenced by MediaWiki\Block\AbstractBlock\__construct().
MediaWiki\Block\AbstractBlock::setReason | ( | $reason | ) |
Set the reason for creating the block.
string | Message | CommentStoreComment | $reason |
Definition at line 163 of file AbstractBlock.php.
Referenced by MediaWiki\Block\AbstractBlock\__construct().
MediaWiki\Block\AbstractBlock::setTarget | ( | $target | ) |
Set the target for this block.
BlockTarget | string | UserIdentity | null | $target |
Definition at line 412 of file AbstractBlock.php.
Referenced by MediaWiki\Block\AbstractBlock\__construct(), and MediaWiki\Block\DatabaseBlockStore\updateTarget().
MediaWiki\Block\AbstractBlock::setTimestamp | ( | $timestamp | ) |
Set the timestamp indicating when the block was created.
string | $timestamp |
Definition at line 403 of file AbstractBlock.php.
Referenced by MediaWiki\Block\AbstractBlock\__construct(), MediaWiki\Block\DatabaseBlockStore\updateBlock(), and MediaWiki\Block\DatabaseBlockStore\updateTimestamp().
MediaWiki\Block\AbstractBlock::toArray | ( | ) |
Implements MediaWiki\Block\Block.
Reimplemented in MediaWiki\Block\CompositeBlock.
Definition at line 560 of file AbstractBlock.php.
|
protected |
Definition at line 54 of file AbstractBlock.php.
|
protected |
Definition at line 57 of file AbstractBlock.php.
|
protected |
Definition at line 51 of file AbstractBlock.php.
|
protected |
Definition at line 48 of file AbstractBlock.php.
|
protected |
Definition at line 60 of file AbstractBlock.php.
|
protected |
Definition at line 63 of file AbstractBlock.php.
|
protected |
Definition at line 69 of file AbstractBlock.php.
|
protected |
Definition at line 42 of file AbstractBlock.php.
|
protected |
Definition at line 66 of file AbstractBlock.php.
|
protected |
Definition at line 45 of file AbstractBlock.php.
Referenced by MediaWiki\Block\DatabaseBlock\isExpired().
|
protected |
Definition at line 72 of file AbstractBlock.php.