MediaWiki  master
MediaWiki\Block\BlockRestrictionStore Class Reference

Public Member Functions

 __construct (ILoadBalancer $loadBalancer, $wikiId=WikiAwareEntity::LOCAL)
 
 delete (array $restrictions)
 Delete the restrictions. More...
 
 deleteByBlockId ( $blockId)
 Delete the restrictions by block ID. More...
 
 deleteByParentBlockId ( $parentBlockId)
 Delete the restrictions by parent block ID. More...
 
 equals (array $a, array $b)
 Checks if two arrays of Restrictions are effectively equal. More...
 
 insert (array $restrictions)
 Inserts the restrictions into the database. More...
 
 loadByBlockId ( $blockId)
 Retrieves the restrictions from the database by block id. More...
 
 setBlockId ( $blockId, array $restrictions)
 Set the blockId on a set of restrictions and return a new set. More...
 
 update (array $restrictions)
 Updates the list of restrictions. More...
 
 updateByParentBlockId ( $parentBlockId, array $restrictions)
 Updates the list of restrictions by parent id. More...
 

Detailed Description

Definition at line 35 of file BlockRestrictionStore.php.

Constructor & Destructor Documentation

◆ __construct()

MediaWiki\Block\BlockRestrictionStore::__construct ( ILoadBalancer  $loadBalancer,
  $wikiId = WikiAwareEntity::LOCAL 
)
Parameters
ILoadBalancer$loadBalancerload balancer for acquiring database connections
string | false$wikiId

Definition at line 60 of file BlockRestrictionStore.php.

Member Function Documentation

◆ delete()

MediaWiki\Block\BlockRestrictionStore::delete ( array  $restrictions)

Delete the restrictions.

Since
1.33
Parameters
Restriction[]$restrictions
Exceptions
MWException
Returns
bool

Definition at line 243 of file BlockRestrictionStore.php.

References $success, and DB_PRIMARY.

◆ deleteByBlockId()

MediaWiki\Block\BlockRestrictionStore::deleteByBlockId (   $blockId)

Delete the restrictions by block ID.

Since
1.33
Parameters
int | array$blockId
Exceptions
MWException
Returns
bool

Definition at line 273 of file BlockRestrictionStore.php.

References DB_PRIMARY.

◆ deleteByParentBlockId()

MediaWiki\Block\BlockRestrictionStore::deleteByParentBlockId (   $parentBlockId)

Delete the restrictions by parent block ID.

Since
1.33
Parameters
int | array$parentBlockId
Exceptions
MWException
Returns
bool

Definition at line 290 of file BlockRestrictionStore.php.

References DB_PRIMARY.

Referenced by MediaWiki\Block\BlockRestrictionStore\updateByParentBlockId().

◆ equals()

MediaWiki\Block\BlockRestrictionStore::equals ( array  $a,
array  $b 
)

Checks if two arrays of Restrictions are effectively equal.

This is a loose equality check as the restrictions do not have to contain the same block ids.

Since
1.33
Parameters
Restriction[]$a
Restriction[]$b
Returns
bool

Definition at line 312 of file BlockRestrictionStore.php.

◆ insert()

MediaWiki\Block\BlockRestrictionStore::insert ( array  $restrictions)

Inserts the restrictions into the database.

Since
1.33
Parameters
Restriction[]$restrictions
Returns
bool

Definition at line 101 of file BlockRestrictionStore.php.

References DB_PRIMARY.

Referenced by MediaWiki\Block\BlockRestrictionStore\update().

◆ loadByBlockId()

MediaWiki\Block\BlockRestrictionStore::loadByBlockId (   $blockId)

Retrieves the restrictions from the database by block id.

Since
1.33
Parameters
int | array$blockId
Returns
Restriction[]

Definition at line 75 of file BlockRestrictionStore.php.

References DB_REPLICA, and MediaWiki\Block\Restriction\PageRestriction\TYPE_ID.

◆ setBlockId()

MediaWiki\Block\BlockRestrictionStore::setBlockId (   $blockId,
array  $restrictions 
)

Set the blockId on a set of restrictions and return a new set.

Since
1.33
Parameters
int$blockId
Restriction[]$restrictions
Returns
Restriction[]

Definition at line 357 of file BlockRestrictionStore.php.

Referenced by MediaWiki\Block\BlockRestrictionStore\updateByParentBlockId().

◆ update()

MediaWiki\Block\BlockRestrictionStore::update ( array  $restrictions)

Updates the list of restrictions.

This method does not allow removing all of the restrictions. To do that, use ::deleteByBlockId().

Since
1.33
Parameters
Restriction[]$restrictions
Returns
bool

Definition at line 138 of file BlockRestrictionStore.php.

References $success, DB_PRIMARY, and MediaWiki\Block\BlockRestrictionStore\insert().

Referenced by MediaWiki\Block\BlockRestrictionStore\updateByParentBlockId().

◆ updateByParentBlockId()

MediaWiki\Block\BlockRestrictionStore::updateByParentBlockId (   $parentBlockId,
array  $restrictions 
)

Updates the list of restrictions by parent id.

Since
1.33
Parameters
int$parentBlockId
Restriction[]$restrictions
Returns
bool

Definition at line 203 of file BlockRestrictionStore.php.

References $success, DB_PRIMARY, MediaWiki\Block\BlockRestrictionStore\deleteByParentBlockId(), MediaWiki\Block\BlockRestrictionStore\setBlockId(), and MediaWiki\Block\BlockRestrictionStore\update().


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