MediaWiki  master
MediaWiki\Block\CompositeBlock Class Reference

Multiple Block class. More...

Inheritance diagram for MediaWiki\Block\CompositeBlock:
Collaboration diagram for MediaWiki\Block\CompositeBlock:

Public Member Functions

 __construct (array $options=[])
 Create a new block with specified parameters on a user, IP or IP range. More...
 
 appliesToNamespace ( $ns)
 
 appliesToPage ( $pageId)
 
 appliesToPasswordReset ()
 
 appliesToRight ( $right)
 
 appliesToTitle (Title $title)
 
 appliesToUsertalk (Title $usertalk=null)
 
 getBy ()
 
 getByName ()
 
 getExpiry ()
 
 getIdentifier ()
 
 getOriginalBlocks ()
 Get the original blocks from which this block is composed. More...
 
- Public Member Functions inherited from MediaWiki\Block\AbstractBlock
 __construct (array $options=[])
 Create a new block with specified parameters on a user, IP or IP range. More...
 
 appliesToNamespace ( $ns)
 Checks if a block applies to a particular namespace. More...
 
 appliesToPage ( $pageId)
 Checks if a block applies to a particular page. More...
 
 appliesToPasswordReset ()
 Check if the block prevents a user from resetting their password. More...
 
 appliesToRight ( $right)
 Determine whether the block prevents a given right. More...
 
 appliesToTitle (Title $title)
 Checks if a block applies to a particular title. More...
 
 appliesToUsertalk (Title $usertalk=null)
 Determine whether the block allows the user to edit their own user talk page. More...
 
 getBlocker ()
 Get the user who implemented this block. More...
 
 getBlockErrorParams (IContextSource $context)
 Get block information used in different block error messages. More...
 
 getBy ()
 Get the user id of the blocking sysop. More...
 
 getByName ()
 Get the username of the blocking sysop. More...
 
 getExpiry ()
 Get the block expiry time. More...
 
 getHideName ()
 Get whether the block hides the target's username. More...
 
 getId ()
 Get the block ID. More...
 
 getIdentifier ()
 Get the information that identifies this block, such that a user could look up everything that can be found about this block. More...
 
 getPermissionsError (IContextSource $context)
 Get the key and parameters for the corresponding error message. More...
 
 getReason ()
 Get the reason given for creating the block, as a string. More...
 
 getReasonComment ()
 Get the reason for creating the block. More...
 
 getTarget ()
 Get the target for this particular block. More...
 
 getTargetAndType ()
 Get the target and target type for this particular block. More...
 
 getTimestamp ()
 Get the timestamp indicating when the block was created. More...
 
 getType ()
 Get the type of target for this particular block. More...
 
 isCreateAccountBlocked ( $x=null)
 Get or set the flag indicating whether this block blocks the target from creating an account. More...
 
 isEmailBlocked ( $x=null)
 Get or set the flag indicating whether this block blocks the target from sending emails. More...
 
 isSitewide ( $x=null)
 Indicates that the block is a sitewide block. More...
 
 isUsertalkEditAllowed ( $x=null)
 Get or set the flag indicating whether this block blocks the target from editing their own user talk page. More...
 
 prevents ( $action, $x=null)
 Get/set whether the block prevents a given action. More...
 
 setBlocker ( $user)
 Set the user who implemented (or will implement) this block. More...
 
 setExpiry ( $expiry)
 Set the block expiry time. More...
 
 setHideName ( $hideName)
 Set whether ths block hides the target's username. More...
 
 setReason ( $reason)
 Set the reason for creating the block. More...
 
 setTarget ( $target)
 Set the target for this block, and update $this->type accordingly. More...
 
 setTimestamp ( $timestamp)
 Set the timestamp indicating when the block was created. More...
 
 shouldTrackWithCookie ( $isAnon)
 Check if the block should be tracked with a cookie. More...
 

Private Member Functions

 methodReturnsValue ( $method, $value,... $params)
 Determine whether any original blocks have a particular method returning a particular value. More...
 
 propHasValue ( $prop, $value)
 Determine whether any original blocks have a particular property set to a particular value. More...
 

Private Attributes

AbstractBlock [] $originalBlocks
 

Additional Inherited Members

- Static Public Member Functions inherited from MediaWiki\Block\AbstractBlock
static parseTarget ( $target)
 From an existing block, get the target and the type of target. More...
 
- Public Attributes inherited from MediaWiki\Block\AbstractBlock
string $mExpiry = ''
 
bool $mHideName = false
 
string $mTimestamp
 
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 $isSitewide = true
 
bool $mBlockEmail = false
 
 $mReason
 
CommentStoreComment $reason
 
User string null $target
 
int null $type
 AbstractBlock::TYPE_ constant. More...
 

Detailed Description

Multiple Block class.

Multiple blocks exist to enforce restrictions from more than one block, if several blocks apply to a user/IP. Multiple blocks are created temporarily on enforcement.

Since
1.34

Definition at line 35 of file CompositeBlock.php.

Constructor & Destructor Documentation

◆ __construct()

MediaWiki\Block\CompositeBlock::__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:
  • originalBlocks: (Block[]) Blocks that this block is composed from

Definition at line 46 of file CompositeBlock.php.

References MediaWiki\Block\AbstractBlock\isCreateAccountBlocked(), MediaWiki\Block\AbstractBlock\isEmailBlocked(), MediaWiki\Block\AbstractBlock\isSitewide(), MediaWiki\Block\AbstractBlock\isUsertalkEditAllowed(), MediaWiki\Block\CompositeBlock\propHasValue(), and MediaWiki\Block\AbstractBlock\setHideName().

Member Function Documentation

◆ appliesToNamespace()

MediaWiki\Block\CompositeBlock::appliesToNamespace (   $ns)

◆ appliesToPage()

MediaWiki\Block\CompositeBlock::appliesToPage (   $pageId)

◆ appliesToPasswordReset()

MediaWiki\Block\CompositeBlock::appliesToPasswordReset ( )

◆ appliesToRight()

MediaWiki\Block\CompositeBlock::appliesToRight (   $right)

Determines whether the CompositeBlock applies to a right by checking whether the original blocks apply to that right. Each block can report true (applies), false (does not apply) or null (unsure). Then:

  • If any original blocks apply, this block applies
  • If no original blocks apply but any are unsure, this block is unsure
  • If all blocks do not apply, this block does not apply

Definition at line 144 of file CompositeBlock.php.

◆ appliesToTitle()

MediaWiki\Block\CompositeBlock::appliesToTitle ( Title  $title)

◆ appliesToUsertalk()

MediaWiki\Block\CompositeBlock::appliesToUsertalk ( Title  $usertalk = null)

◆ getBy()

MediaWiki\Block\CompositeBlock::getBy ( )

Definition at line 198 of file CompositeBlock.php.

◆ getByName()

MediaWiki\Block\CompositeBlock::getByName ( )

Definition at line 205 of file CompositeBlock.php.

◆ getExpiry()

MediaWiki\Block\CompositeBlock::getExpiry ( )

Definition at line 112 of file CompositeBlock.php.

◆ getIdentifier()

MediaWiki\Block\CompositeBlock::getIdentifier ( )

Definition at line 126 of file CompositeBlock.php.

◆ getOriginalBlocks()

MediaWiki\Block\CompositeBlock::getOriginalBlocks ( )

Get the original blocks from which this block is composed.

Since
1.34
Returns
AbstractBlock[]

Definition at line 105 of file CompositeBlock.php.

References MediaWiki\Block\CompositeBlock\$originalBlocks.

◆ methodReturnsValue()

MediaWiki\Block\CompositeBlock::methodReturnsValue (   $method,
  $value,
  $params 
)
private

Determine whether any original blocks have a particular method returning a particular value.

Parameters
string$method
mixed$value
mixed...$params
Returns
bool At least one block has the method returning the value

Definition at line 90 of file CompositeBlock.php.

Referenced by MediaWiki\Block\CompositeBlock\appliesToNamespace(), MediaWiki\Block\CompositeBlock\appliesToPage(), MediaWiki\Block\CompositeBlock\appliesToPasswordReset(), MediaWiki\Block\CompositeBlock\appliesToTitle(), and MediaWiki\Block\CompositeBlock\appliesToUsertalk().

◆ propHasValue()

MediaWiki\Block\CompositeBlock::propHasValue (   $prop,
  $value 
)
private

Determine whether any original blocks have a particular property set to a particular value.

Parameters
string$prop
mixed$value
Returns
bool At least one block has the property set to the value

Definition at line 72 of file CompositeBlock.php.

Referenced by MediaWiki\Block\CompositeBlock\__construct().

Member Data Documentation

◆ $originalBlocks

AbstractBlock [] MediaWiki\Block\CompositeBlock::$originalBlocks
private

Definition at line 37 of file CompositeBlock.php.

Referenced by MediaWiki\Block\CompositeBlock\getOriginalBlocks().


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