MediaWiki  master
MediaWiki\Block\DatabaseBlockStore Class Reference
Collaboration diagram for MediaWiki\Block\DatabaseBlockStore:

Public Member Functions

 __construct (ServiceOptions $options, LoggerInterface $logger, ActorMigration $actorMigration, BlockRestrictionStore $blockRestrictionStore, CommentStore $commentStore, HookContainer $hookContainer, ILoadBalancer $loadBalancer, ReadOnlyMode $readOnlyMode)
 
 deleteBlock (DatabaseBlock $block)
 Delete a DatabaseBlock from the database. More...
 
 insertBlock (DatabaseBlock $block, IDatabase $database=null)
 Insert a block into the block table. More...
 
 purgeExpiredBlocks ()
 Delete expired blocks from the ipblocks table. More...
 
 updateBlock (DatabaseBlock $block)
 Update a block in the DB with new parameters. More...
 

Public Attributes

const CONSTRUCTOR_OPTIONS
 

Private Member Functions

 doRetroactiveAutoblock (DatabaseBlock $block)
 Handles retroactively autoblocking the last IP used by the user (if it is a user) blocked by an auto block. More...
 
 getArrayForAutoblockUpdate (DatabaseBlock $block)
 Get an array suitable for autoblock updates. More...
 
 getArrayForDatabaseBlock (DatabaseBlock $block, IDatabase $dbw)
 Get an array suitable for passing to $dbw->insert() or $dbw->update() More...
 
 performRetroactiveAutoblock (DatabaseBlock $block)
 Actually retroactively autoblocks the last IP used by the user (if it is a user) blocked by this block. More...
 

Private Attributes

ActorMigration $actorMigration
 
BlockRestrictionStore $blockRestrictionStore
 
CommentStore $commentStore
 
HookRunner $hookRunner
 
ILoadBalancer $loadBalancer
 
LoggerInterface $logger
 
ServiceOptions $options
 
ReadOnlyMode $readOnlyMode
 

Detailed Description

Since
1.36
Author
DannyS712

Definition at line 44 of file DatabaseBlockStore.php.

Constructor & Destructor Documentation

◆ __construct()

MediaWiki\Block\DatabaseBlockStore::__construct ( ServiceOptions  $options,
LoggerInterface  $logger,
ActorMigration  $actorMigration,
BlockRestrictionStore  $blockRestrictionStore,
CommentStore  $commentStore,
HookContainer  $hookContainer,
ILoadBalancer  $loadBalancer,
ReadOnlyMode  $readOnlyMode 
)

Member Function Documentation

◆ deleteBlock()

MediaWiki\Block\DatabaseBlockStore::deleteBlock ( DatabaseBlock  $block)

Delete a DatabaseBlock from the database.

Parameters
DatabaseBlock$block
Returns
bool whether it was deleted
Exceptions
MWException

Definition at line 300 of file DatabaseBlockStore.php.

References DB_MASTER, and MediaWiki\Block\DatabaseBlock\getId().

◆ doRetroactiveAutoblock()

MediaWiki\Block\DatabaseBlockStore::doRetroactiveAutoblock ( DatabaseBlock  $block)
private

Handles retroactively autoblocking the last IP used by the user (if it is a user) blocked by an auto block.

Parameters
DatabaseBlock$block
Returns
array IDs of retroactive autoblocks made

Definition at line 423 of file DatabaseBlockStore.php.

References MediaWiki\Block\AbstractBlock\getTarget(), MediaWiki\Block\DatabaseBlock\getType(), MediaWiki\Block\DatabaseBlock\isAutoblocking(), MediaWiki\Block\DatabaseBlockStore\performRetroactiveAutoblock(), and MediaWiki\Block\AbstractBlock\TYPE_USER.

Referenced by MediaWiki\Block\DatabaseBlockStore\insertBlock(), and MediaWiki\Block\DatabaseBlockStore\updateBlock().

◆ getArrayForAutoblockUpdate()

◆ getArrayForDatabaseBlock()

◆ insertBlock()

MediaWiki\Block\DatabaseBlockStore::insertBlock ( DatabaseBlock  $block,
IDatabase  $database = null 
)

Insert a block into the block table.

Will fail if there is a conflicting block (same name and options) already in the database.

Parameters
DatabaseBlock$block
IDatabase | null$databaseDatabase to use if not the same as the one in the load balancer
Returns
bool|array False on failure, assoc array on success: ('id' => block ID, 'autoIds' => array of autoblock IDs)
Exceptions
MWException

Definition at line 151 of file DatabaseBlockStore.php.

References DB_MASTER, MediaWiki\Block\DatabaseBlockStore\doRetroactiveAutoblock(), MediaWiki\Block\DatabaseBlockStore\getArrayForDatabaseBlock(), MediaWiki\Block\DatabaseBlock\getBlocker(), MediaWiki\Block\DatabaseBlock\getId(), MediaWiki\Block\DatabaseBlock\getRawRestrictions(), MediaWiki\Block\AbstractBlock\getTarget(), MediaWiki\Block\AbstractBlock\getTimestamp(), MediaWiki\Block\DatabaseBlockStore\purgeExpiredBlocks(), and MediaWiki\Block\DatabaseBlock\setId().

◆ performRetroactiveAutoblock()

MediaWiki\Block\DatabaseBlockStore::performRetroactiveAutoblock ( DatabaseBlock  $block)
private

Actually retroactively autoblocks the last IP used by the user (if it is a user) blocked by this block.

This will use the recentchanges table.

Parameters
DatabaseBlock$block
Returns
array

Definition at line 454 of file DatabaseBlockStore.php.

References $dbr, MediaWiki\Block\DatabaseBlockStore\$options, $res, $type, DB_REPLICA, MediaWiki\Block\DatabaseBlock\doAutoblock(), MediaWiki\Block\AbstractBlock\getTargetAndType(), and MediaWiki\Block\AbstractBlock\TYPE_USER.

Referenced by MediaWiki\Block\DatabaseBlockStore\doRetroactiveAutoblock().

◆ purgeExpiredBlocks()

◆ updateBlock()

MediaWiki\Block\DatabaseBlockStore::updateBlock ( DatabaseBlock  $block)

Member Data Documentation

◆ $actorMigration

ActorMigration MediaWiki\Block\DatabaseBlockStore::$actorMigration
private

◆ $blockRestrictionStore

BlockRestrictionStore MediaWiki\Block\DatabaseBlockStore::$blockRestrictionStore
private

◆ $commentStore

CommentStore MediaWiki\Block\DatabaseBlockStore::$commentStore
private

◆ $hookRunner

HookRunner MediaWiki\Block\DatabaseBlockStore::$hookRunner
private

Definition at line 70 of file DatabaseBlockStore.php.

◆ $loadBalancer

ILoadBalancer MediaWiki\Block\DatabaseBlockStore::$loadBalancer
private

◆ $logger

LoggerInterface MediaWiki\Block\DatabaseBlockStore::$logger
private

◆ $options

ServiceOptions MediaWiki\Block\DatabaseBlockStore::$options
private

◆ $readOnlyMode

ReadOnlyMode MediaWiki\Block\DatabaseBlockStore::$readOnlyMode
private

◆ CONSTRUCTOR_OPTIONS

const MediaWiki\Block\DatabaseBlockStore::CONSTRUCTOR_OPTIONS
Initial value:
= [
'PutIPinRC',
'BlockDisablesLogin',
]

Definition at line 52 of file DatabaseBlockStore.php.


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