MediaWiki
1.33.0
|
Public Member Functions | |
__construct (ILoadBalancer $loadBalancer) | |
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, IDatabase $db=null) | |
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... | |
Private Member Functions | |
restrictionsByBlockId (array $restrictions) | |
Converts an array of restrictions to an associative array of restrictions where the keys are the block ids. More... | |
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. More... | |
resultToRestrictions (IResultWrapper $result) | |
Convert an Result Wrapper to an array of restrictions. More... | |
rowToRestriction (\stdClass $row) | |
Convert a result row from the database into a restriction object. More... | |
Private Attributes | |
ILoadBalancer | $loadBalancer |
$types | |
Map of all of the restriction types. More... | |
Definition at line 33 of file BlockRestrictionStore.php.
MediaWiki\Block\BlockRestrictionStore::__construct | ( | ILoadBalancer | $loadBalancer | ) |
Definition at line 51 of file BlockRestrictionStore.php.
References MediaWiki\Block\BlockRestrictionStore\$loadBalancer.
MediaWiki\Block\BlockRestrictionStore::delete | ( | array | $restrictions | ) |
Delete the restrictions.
Restriction[] | null | $restrictions |
MWException |
Definition at line 231 of file BlockRestrictionStore.php.
MediaWiki\Block\BlockRestrictionStore::deleteByBlockId | ( | $blockId | ) |
Delete the restrictions by Block ID.
int | array | $blockId |
MWException |
Definition at line 261 of file BlockRestrictionStore.php.
References DB_MASTER.
MediaWiki\Block\BlockRestrictionStore::deleteByParentBlockId | ( | $parentBlockId | ) |
Delete the restrictions by Parent Block ID.
int | array | $parentBlockId |
MWException |
Definition at line 278 of file BlockRestrictionStore.php.
References DB_MASTER.
Referenced by MediaWiki\Block\BlockRestrictionStore\updateByParentBlockId().
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 300 of file BlockRestrictionStore.php.
References $filter, and captcha-old\count.
MediaWiki\Block\BlockRestrictionStore::insert | ( | array | $restrictions | ) |
Inserts the restrictions into the database.
Restriction[] | $restrictions |
Definition at line 89 of file BlockRestrictionStore.php.
References $rows, as, and DB_MASTER.
Referenced by MediaWiki\Block\BlockRestrictionStore\update().
Retrieves the restrictions from the database by block id.
int | array | $blockId | |
IDatabase | null | $db |
Definition at line 63 of file BlockRestrictionStore.php.
References DB_REPLICA, MediaWiki\Block\BlockRestrictionStore\resultToRestrictions(), and MediaWiki\Block\Restriction\PageRestriction\TYPE_ID.
|
private |
Converts an array of restrictions to an associative array of restrictions where the keys are the block ids.
Restriction[] | $restrictions |
Definition at line 395 of file BlockRestrictionStore.php.
References as.
Referenced by MediaWiki\Block\BlockRestrictionStore\update().
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 372 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 420 of file BlockRestrictionStore.php.
References as, and 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 441 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 345 of file BlockRestrictionStore.php.
References as.
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 126 of file BlockRestrictionStore.php.
References $success, as, DB_MASTER, 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 191 of file BlockRestrictionStore.php.
References $success, as, DB_MASTER, MediaWiki\Block\BlockRestrictionStore\deleteByParentBlockId(), MediaWiki\Block\BlockRestrictionStore\setBlockId(), and MediaWiki\Block\BlockRestrictionStore\update().
|
private |
Definition at line 46 of file BlockRestrictionStore.php.
Referenced by MediaWiki\Block\BlockRestrictionStore\__construct().
|
private |
Map of all of the restriction types.
Definition at line 38 of file BlockRestrictionStore.php.