MediaWiki REL1_37
|
Public Member Functions | |
__construct (ILoadBalancer $loadBalancer) | |
delete (array $restrictions) | |
Delete the restrictions. | |
deleteByBlockId ( $blockId) | |
Delete the restrictions by block ID. | |
deleteByParentBlockId ( $parentBlockId) | |
Delete the restrictions by parent block ID. | |
equals (array $a, array $b) | |
Checks if two arrays of Restrictions are effectively equal. | |
insert (array $restrictions) | |
Inserts the restrictions into the database. | |
loadByBlockId ( $blockId, IDatabase $db=null) | |
Retrieves the restrictions from the database by block id. | |
setBlockId ( $blockId, array $restrictions) | |
Set the blockId on a set of restrictions and return a new set. | |
update (array $restrictions) | |
Updates the list of restrictions. | |
updateByParentBlockId ( $parentBlockId, array $restrictions) | |
Updates the list of restrictions by parent id. | |
Private Member Functions | |
restrictionsByBlockId (array $restrictions) | |
Converts an array of restrictions to an associative array of restrictions where the keys are the block ids. | |
restrictionsToRemove (array $existing, array $new) | |
Get the restrictions that should be removed, which are existing restrictions that are not in the new list of restrictions. | |
resultToRestrictions (IResultWrapper $result) | |
Convert an Result Wrapper to an array of restrictions. | |
rowToRestriction (stdClass $row) | |
Convert a result row from the database into a restriction object. | |
Private Attributes | |
ILoadBalancer | $loadBalancer |
const | TYPES_MAP |
Map of all of the restriction types. | |
Definition at line 35 of file BlockRestrictionStore.php.
MediaWiki\Block\BlockRestrictionStore::__construct | ( | ILoadBalancer | $loadBalancer | ) |
ILoadBalancer | $loadBalancer | load balancer for acquiring database connections |
Definition at line 54 of file BlockRestrictionStore.php.
References MediaWiki\Block\BlockRestrictionStore\$loadBalancer.
MediaWiki\Block\BlockRestrictionStore::delete | ( | array | $restrictions | ) |
Delete the restrictions.
Restriction[] | $restrictions |
MWException |
Definition at line 234 of file BlockRestrictionStore.php.
References $success, and DB_PRIMARY.
MediaWiki\Block\BlockRestrictionStore::deleteByBlockId | ( | $blockId | ) |
Delete the restrictions by block ID.
int | array | $blockId |
MWException |
Definition at line 264 of file BlockRestrictionStore.php.
References DB_PRIMARY.
Referenced by MediaWiki\Block\DatabaseBlockStore\purgeExpiredBlocks().
MediaWiki\Block\BlockRestrictionStore::deleteByParentBlockId | ( | $parentBlockId | ) |
Delete the restrictions by parent block ID.
int | array | $parentBlockId |
MWException |
Definition at line 281 of file BlockRestrictionStore.php.
References DB_PRIMARY.
Referenced by MediaWiki\Block\BlockRestrictionStore\updateByParentBlockId().
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.
Restriction[] | $a | |
Restriction[] | $b |
Definition at line 303 of file BlockRestrictionStore.php.
MediaWiki\Block\BlockRestrictionStore::insert | ( | array | $restrictions | ) |
Inserts the restrictions into the database.
Restriction[] | $restrictions |
Definition at line 92 of file BlockRestrictionStore.php.
References DB_PRIMARY.
Referenced by MediaWiki\Block\BlockRestrictionStore\update().
MediaWiki\Block\BlockRestrictionStore::loadByBlockId | ( | $blockId, | |
IDatabase | $db = null |
||
) |
Retrieves the restrictions from the database by block id.
int | array | $blockId | |
IDatabase | null | $db |
Definition at line 66 of file BlockRestrictionStore.php.
References DB_REPLICA, and MediaWiki\Block\BlockRestrictionStore\resultToRestrictions().
|
private |
Converts an array of restrictions to an associative array of restrictions where the keys are the block ids.
Restriction[] | $restrictions |
Definition at line 398 of file BlockRestrictionStore.php.
Referenced by MediaWiki\Block\BlockRestrictionStore\update().
|
private |
Get the restrictions that should be removed, which are existing restrictions that are not in the new list of restrictions.
Restriction[] | $existing | |
Restriction[] | $new |
Definition at line 375 of file BlockRestrictionStore.php.
Referenced by MediaWiki\Block\BlockRestrictionStore\update().
|
private |
Convert an Result Wrapper to an array of restrictions.
IResultWrapper | $result |
Definition at line 423 of file BlockRestrictionStore.php.
References MediaWiki\Block\BlockRestrictionStore\rowToRestriction().
Referenced by MediaWiki\Block\BlockRestrictionStore\loadByBlockId(), and MediaWiki\Block\BlockRestrictionStore\update().
|
private |
Convert a result row from the database into a restriction object.
stdClass | $row |
Definition at line 444 of file BlockRestrictionStore.php.
Referenced by MediaWiki\Block\BlockRestrictionStore\resultToRestrictions().
MediaWiki\Block\BlockRestrictionStore::setBlockId | ( | $blockId, | |
array | $restrictions | ||
) |
Set the blockId on a set of restrictions and return a new set.
int | $blockId | |
Restriction[] | $restrictions |
Definition at line 348 of file BlockRestrictionStore.php.
Referenced by MediaWiki\Block\BlockRestrictionStore\updateByParentBlockId().
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().
Restriction[] | $restrictions |
Definition at line 129 of file BlockRestrictionStore.php.
References $success, DB_PRIMARY, MediaWiki\Block\BlockRestrictionStore\insert(), MediaWiki\Block\BlockRestrictionStore\restrictionsByBlockId(), MediaWiki\Block\BlockRestrictionStore\restrictionsToRemove(), and MediaWiki\Block\BlockRestrictionStore\resultToRestrictions().
Referenced by MediaWiki\Block\BlockRestrictionStore\updateByParentBlockId().
MediaWiki\Block\BlockRestrictionStore::updateByParentBlockId | ( | $parentBlockId, | |
array | $restrictions | ||
) |
Updates the list of restrictions by parent id.
int | $parentBlockId | |
Restriction[] | $restrictions |
Definition at line 194 of file BlockRestrictionStore.php.
References $success, DB_PRIMARY, MediaWiki\Block\BlockRestrictionStore\deleteByParentBlockId(), MediaWiki\Block\BlockRestrictionStore\setBlockId(), and MediaWiki\Block\BlockRestrictionStore\update().
|
private |
Definition at line 49 of file BlockRestrictionStore.php.
Referenced by MediaWiki\Block\BlockRestrictionStore\__construct().
|
private |
Map of all of the restriction types.
Definition at line 40 of file BlockRestrictionStore.php.