MediaWiki master
|
Represents a block that may prevent users from performing specific operations. More...
Inherits MediaWiki\DAO\WikiAwareEntity.
Inherited by MediaWiki\Block\AbstractBlock.
Public Member Functions | |
getBlocker () | |
Get the user who applied this block. | |
getExpiry () | |
Get the block expiry time. | |
getId ( $wikiId=self::LOCAL) | |
Get the block ID. | |
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. | |
getReasonComment () | |
Get the reason for creating the block. | |
getTargetName () | |
Return the name of the block target as a string. | |
getTargetUserIdentity () | |
Get the UserIdentity identifying the blocked user, if the target is indeed a user (that is, if getType() returns TYPE_USER). | |
getTimestamp () | |
Get the timestamp indicating when the block was created. | |
getType () | |
Get the type of target for this particular block. | |
isBlocking ( $target) | |
Determine whether this block is blocking the given target (and only that target). | |
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. | |
toArray () | |
Convert a block to an array of blocks. | |
Public Member Functions inherited from MediaWiki\DAO\WikiAwareEntity | |
assertWiki ( $wikiId) | |
Throws if $wikiId is different from the return value of getWikiId(). | |
getWikiId () | |
Get the ID of the wiki this page belongs to. | |
Public Attributes | |
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 |
Represents a block that may prevent users from performing specific operations.
The block may apply to a specific user, to a network address, network range, or some other aspect of a web request.
The block may apply to the entire site, or may be limited to specific pages or namespaces.
Extracted from the AbstractBlock base class, which was in turn factored out of DatabaseBlock in 1.34. Block was introduced as a narrow interface for Authority. It avoids legacy types such as User and Title. However, all implementations should continue to extend AbstractBlock.
Extends WikiAwareEntity since 1.38.
MediaWiki\Block\Block::getBlocker | ( | ) |
Get the user who applied this block.
Implemented in MediaWiki\Block\CompositeBlock, MediaWiki\Block\DatabaseBlock, and MediaWiki\Block\SystemBlock.
MediaWiki\Block\Block::getExpiry | ( | ) |
Get the block expiry time.
Implemented in MediaWiki\Block\AbstractBlock, and MediaWiki\Block\CompositeBlock.
MediaWiki\Block\Block::getId | ( | $wikiId = self::LOCAL | ) |
Get the block ID.
string | false | $wikiId | (since 1.38) |
Implemented in MediaWiki\Block\AbstractBlock, and MediaWiki\Block\DatabaseBlock.
MediaWiki\Block\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.
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.
string | false | $wikiId | (since 1.38) |
Implemented in MediaWiki\Block\CompositeBlock, MediaWiki\Block\DatabaseBlock, and MediaWiki\Block\SystemBlock.
MediaWiki\Block\Block::getReasonComment | ( | ) |
Get the reason for creating the block.
Implemented in MediaWiki\Block\AbstractBlock.
MediaWiki\Block\Block::getTargetName | ( | ) |
Return the name of the block target as a string.
Depending on the type returned by getType(), this could be a user name, an IP address or range, an internal ID, etc.
Implemented in MediaWiki\Block\AbstractBlock.
MediaWiki\Block\Block::getTargetUserIdentity | ( | ) |
Get the UserIdentity identifying the blocked user, if the target is indeed a user (that is, if getType() returns TYPE_USER).
Implemented in MediaWiki\Block\AbstractBlock.
MediaWiki\Block\Block::getTimestamp | ( | ) |
Get the timestamp indicating when the block was created.
Implemented in MediaWiki\Block\AbstractBlock, and MediaWiki\Block\CompositeBlock.
MediaWiki\Block\Block::getType | ( | ) |
Get the type of target for this particular block.
Implemented in MediaWiki\Block\AbstractBlock, and MediaWiki\Block\DatabaseBlock.
MediaWiki\Block\Block::isBlocking | ( | $target | ) |
Determine whether this block is blocking the given target (and only that target).
UserIdentity | string | $target |
Implemented in MediaWiki\Block\AbstractBlock.
MediaWiki\Block\Block::isCreateAccountBlocked | ( | ) |
Get the flag indicating whether this block blocks the target from creating an account.
(Note that the flag may be overridden depending on global configs.)
Referenced by MediaWiki\Block\DatabaseBlock\__construct(), and MediaWiki\Block\SystemBlock\appliesToPasswordReset().
MediaWiki\Block\Block::isHardblock | ( | ) |
Get 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.
Referenced by MediaWiki\Block\AbstractBlock\__construct().
MediaWiki\Block\Block::isSitewide | ( | ) |
Get whether 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).
Referenced by MediaWiki\Block\DatabaseBlock\__construct().
MediaWiki\Block\Block::toArray | ( | ) |
Convert a block to an array of blocks.
If the block is a composite block, return the array of original blocks. Otherwise, return [$this].
Implemented in MediaWiki\Block\AbstractBlock, and MediaWiki\Block\CompositeBlock.
const MediaWiki\Block\Block::BLOCK_TYPES |
const MediaWiki\Block\Block::TYPE_AUTO = 4 |
Definition at line 52 of file Block.php.
Referenced by MediaWiki\Block\UnblockUser\__construct(), MediaWiki\Block\DatabaseBlockStore\newListFromTarget(), and MediaWiki\Block\BlockUtils\parseBlockTargetRow().
const MediaWiki\Block\Block::TYPE_ID = 5 |
Definition at line 53 of file Block.php.
Referenced by MediaWiki\Block\DatabaseBlockStore\newListFromTarget().
const MediaWiki\Block\Block::TYPE_IP = 2 |
Definition at line 50 of file Block.php.
Referenced by MediaWiki\Block\DatabaseBlock\getRangeEnd(), MediaWiki\Block\DatabaseBlock\getRangeStart(), MediaWiki\Block\DatabaseBlockStore\newListFromTarget(), MediaWiki\Block\BlockUtils\parseBlockTarget(), and MediaWiki\Block\BlockUtils\parseBlockTargetRow().
const MediaWiki\Block\Block::TYPE_RANGE = 3 |
Definition at line 51 of file Block.php.
Referenced by MediaWiki\Block\DatabaseBlock\getRangeEnd(), MediaWiki\Block\DatabaseBlock\getRangeStart(), MediaWiki\Block\DatabaseBlockStore\newListFromTarget(), and MediaWiki\Block\BlockUtils\parseBlockTargetRow().
const MediaWiki\Block\Block::TYPE_USER = 1 |
Definition at line 49 of file Block.php.
Referenced by MediaWiki\Block\BlockUser\__construct(), MediaWiki\Block\DatabaseBlock\getRangeEnd(), MediaWiki\Block\DatabaseBlock\getRangeStart(), MediaWiki\Block\DatabaseBlockStore\newListFromTarget(), MediaWiki\Block\BlockUtils\parseBlockTarget(), and MediaWiki\Block\BlockUtils\parseBlockTargetRow().