MediaWiki master
Block.php
Go to the documentation of this file.
1<?php
2
8namespace MediaWiki\Block;
9
13
31interface Block extends WikiAwareEntity {
32
33 # TYPE constants
34 # Do not introduce negative constants without changing BlockUser command object.
35 public const TYPE_USER = 1;
36 public const TYPE_IP = 2;
37 public const TYPE_RANGE = 3;
38 public const TYPE_AUTO = 4;
39
43 public const BLOCK_TYPES = [
44 self::TYPE_USER => 'user',
45 self::TYPE_IP => 'ip',
46 self::TYPE_RANGE => 'range',
47 self::TYPE_AUTO => 'autoblock',
48 ];
49
56 public function getId( $wikiId = self::LOCAL ): ?int;
57
67 public function getIdentifier( $wikiId = self::LOCAL );
68
74 public function getBlocker(): ?UserIdentity;
75
82
93 public function getTarget(): ?BlockTarget;
94
102 public function getRedactedTarget(): ?BlockTarget;
103
111
119 public function getTargetName(): string;
120
128 public function isBlocking( $target ): bool;
129
135 public function getExpiry(): string;
136
143 public function isIndefinite(): bool;
144
149 public function getType(): ?int;
150
156 public function getTimestamp(): string;
157
165 public function isSitewide(): bool;
166
174 public function isCreateAccountBlocked(): bool;
175
181 public function isEmailBlocked(): bool;
182
193 public function isHardblock(): bool;
194
202 public function toArray(): array;
203
208 public function appliesToUsertalk(): bool;
209
210}
Base class for block targets.
Value object for a comment stored by CommentStore.
Represents a block that may prevent users from performing specific operations.
Definition Block.php:31
isSitewide()
Get whether the block is a sitewide block.
isHardblock()
Get whether the block is a hard block (affects logged-in users on a given IP/range).
getBlocker()
Get the user who applied this block.
getTimestamp()
Get the timestamp indicating when the block was created.
getTargetName()
Return the name of the block target as a string.
isEmailBlocked()
Get the flag indicating whether this block blocks the target from sending emails.
getTargetUserIdentity()
Get the UserIdentity identifying the blocked user, if the target is indeed a user (that is,...
getTarget()
Get the target as an object.
getIdentifier( $wikiId=self::LOCAL)
Get the information that identifies this block, such that a user could look up everything that can be...
isBlocking( $target)
Determine whether this block is blocking the given target (and only that target).
getRedactedTarget()
Get the target, with the IP address hidden behind an AutoBlockTarget if the block is an autoblock.
getId( $wikiId=self::LOCAL)
Get the block ID.
appliesToUsertalk()
Returns whether the block prevents user talk page access.
toArray()
Convert a block to an array of blocks.
getReasonComment()
Get the reason for creating the block.
isCreateAccountBlocked()
Get the flag indicating whether this block blocks the target from creating an account.
const BLOCK_TYPES
Map block types to strings, to allow convenient logging.
Definition Block.php:43
getType()
Get the type of target for this particular block.
isIndefinite()
Is the block indefinite (with no fixed expiry)?
getExpiry()
Get the block expiry time.
Marker interface for entities aware of the wiki they belong to.
Interface for objects representing user identity.