MediaWiki master
Block.php
Go to the documentation of this file.
1<?php
2
8namespace MediaWiki\Block;
9
14
32interface Block extends WikiAwareEntity {
33
34 # TYPE constants
35 # Do not introduce negative constants without changing BlockUser command object.
36 public const TYPE_USER = 1;
37 public const TYPE_IP = 2;
38 public const TYPE_RANGE = 3;
39 public const TYPE_AUTO = 4;
40
44 public const BLOCK_TYPES = [
45 self::TYPE_USER => 'user',
46 self::TYPE_IP => 'ip',
47 self::TYPE_RANGE => 'range',
48 self::TYPE_AUTO => 'autoblock',
49 ];
50
57 public function getId( $wikiId = self::LOCAL ): ?int;
58
68 public function getIdentifier( $wikiId = self::LOCAL );
69
75 public function getBlocker(): ?UserIdentity;
76
83
94 public function getTarget(): ?BlockTarget;
95
103 public function getRedactedTarget(): ?BlockTarget;
104
112
120 public function getTargetName(): string;
121
129 public function isBlocking( $target ): bool;
130
136 public function getExpiry(): string;
137
144 public function isIndefinite(): bool;
145
150 public function getType(): ?int;
151
157 public function getTimestamp(): string;
158
166 public function isSitewide(): bool;
167
175 public function isCreateAccountBlocked(): bool;
176
182 public function isEmailBlocked(): bool;
183
194 public function isHardblock(): bool;
195
203 public function toArray(): array;
204
212 public function appliesToUsertalk( ?PageIdentity $usertalk = null ): bool;
213
214}
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:32
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.
appliesToUsertalk(?PageIdentity $usertalk=null)
Returns whether the block prevents user talk page access.
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.
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:44
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 (potentially) representing an editable wiki page.
Interface for objects representing user identity.