MediaWiki  master
MediaWiki\Block\DatabaseBlockStore Class Reference

Public Member Functions

 __construct (ServiceOptions $options, LoggerInterface $logger, ActorStoreFactory $actorStoreFactory, BlockRestrictionStore $blockRestrictionStore, CommentStore $commentStore, HookContainer $hookContainer, ILoadBalancer $loadBalancer, ReadOnlyMode $readOnlyMode, UserFactory $userFactory)
 
 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
 

Detailed Description

Since
1.36
Author
DannyS712

Definition at line 47 of file DatabaseBlockStore.php.

Constructor & Destructor Documentation

◆ __construct()

MediaWiki\Block\DatabaseBlockStore::__construct ( ServiceOptions  $options,
LoggerInterface  $logger,
ActorStoreFactory  $actorStoreFactory,
BlockRestrictionStore  $blockRestrictionStore,
CommentStore  $commentStore,
HookContainer  $hookContainer,
ILoadBalancer  $loadBalancer,
ReadOnlyMode  $readOnlyMode,
UserFactory  $userFactory 
)
Parameters
ServiceOptions$options
LoggerInterface$logger
ActorStoreFactory$actorStoreFactory
BlockRestrictionStore$blockRestrictionStore
CommentStore$commentStore
HookContainer$hookContainer
ILoadBalancer$loadBalancer
ReadOnlyMode$readOnlyMode
UserFactory$userFactory

Definition at line 96 of file DatabaseBlockStore.php.

References MediaWiki\Config\ServiceOptions\assertRequiredOptions().

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 358 of file DatabaseBlockStore.php.

◆ 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. Must connect to the wiki identified by $block->getBlocker->getWikiId().
Returns
bool|array False on failure, assoc array on success: ('id' => block ID, 'autoIds' => array of autoblock IDs)
Exceptions
MWException

Definition at line 190 of file DatabaseBlockStore.php.

References MediaWiki\MainConfigNames\BlockDisablesLogin, DB_PRIMARY, MediaWiki\Block\DatabaseBlock\getBlocker(), MediaWiki\Block\DatabaseBlock\getId(), MediaWiki\Block\DatabaseBlock\getRawRestrictions(), MediaWiki\Block\AbstractBlock\getTargetUserIdentity(), MediaWiki\Block\AbstractBlock\getTimestamp(), MediaWiki\Block\AbstractBlock\getWikiId(), MediaWiki\Block\DatabaseBlockStore\purgeExpiredBlocks(), and MediaWiki\Block\DatabaseBlock\setId().

◆ purgeExpiredBlocks()

◆ updateBlock()

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

Update a block in the DB with new parameters.

The ID field needs to be loaded first.

Parameters
DatabaseBlock$block
Returns
bool|array False on failure, array on success: ('id' => block ID, 'autoIds' => array of autoblock IDs)

Definition at line 275 of file DatabaseBlockStore.php.

References $success, DB_PRIMARY, MediaWiki\Block\DatabaseBlock\getId(), MediaWiki\Block\DatabaseBlock\getRawRestrictions(), MediaWiki\Block\AbstractBlock\getTimestamp(), MediaWiki\Block\AbstractBlock\getWikiId(), and MediaWiki\Block\DatabaseBlock\isAutoblocking().

Member Data Documentation

◆ CONSTRUCTOR_OPTIONS

const MediaWiki\Block\DatabaseBlockStore::CONSTRUCTOR_OPTIONS
Initial value:
= [
]
const UpdateRowsPerQuery
Name constant for the UpdateRowsPerQuery setting, for use with Config::get()
const BlockDisablesLogin
Name constant for the BlockDisablesLogin setting, for use with Config::get()
const PutIPinRC
Name constant for the PutIPinRC setting, for use with Config::get()
Access: internal
For use by ServiceWiring

Definition at line 55 of file DatabaseBlockStore.php.


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