MediaWiki REL1_37
|
Class RestrictionStore. More...
Public Member Functions | |
__construct (ServiceOptions $options, WANObjectCache $wanCache, ILoadBalancer $loadBalancer, LinkCache $linkCache, CommentStore $commentStore, HookContainer $hookContainer, PageStore $pageStore) | |
areCascadeProtectionSourcesLoaded (PageIdentity $page) | |
Determines whether cascading protection sources have already been loaded from the database. | |
areRestrictionsCascading (PageIdentity $page) | |
Checks if restrictions are cascading for the current page. | |
areRestrictionsLoaded (PageIdentity $page) | |
deleteCreateProtection (PageIdentity $page) | |
Remove any title creation protection due to page existing. | |
flushRestrictions (PageIdentity $page) | |
Flush the protection cache in this object and force reload from the database. | |
getAllRestrictions (PageIdentity $page) | |
Returns the restricted actions and their restrictions for the specified page. | |
getCascadeProtectionSources (PageIdentity $page) | |
Cascading protection: Get the source of any cascading restrictions on this page. | |
getCreateProtection (PageIdentity $page) | |
Is this title subject to protection against creation? | |
getRestrictionExpiry (PageIdentity $page, string $action) | |
Get the expiry time for the restriction against a given action. | |
getRestrictions (PageIdentity $page, string $action) | |
Returns list of restrictions for specified page. | |
isCascadeProtected (PageIdentity $page) | |
Cascading protection: Return true if cascading restrictions apply to this page, false if not. | |
isProtected (PageIdentity $page, string $action='') | |
Does the title correspond to a protected article? | |
isSemiProtected (PageIdentity $page, string $action='edit') | |
Is this page "semi-protected" - the only protection levels are listed in $wgSemiprotectedRestrictionLevels? | |
listAllRestrictionTypes (bool $exists=true) | |
Get a filtered list of all restriction types supported by this wiki. | |
listApplicableRestrictionTypes (PageIdentity $page) | |
Returns restriction types for the current page. | |
loadRestrictions (PageIdentity $page, int $flags=IDBAccessObject::READ_NORMAL, ?string $oldRestrictions=null) | |
Load restrictions from page.page_restrictions and the page_restrictions table. | |
loadRestrictionsFromRows (PageIdentity $page, array $rows, ?string $oldRestrictions=null) | |
Compiles list of active page restrictions for this existing page. | |
registerOldRestrictions (PageIdentity $page, string $oldRestrictions) | |
Register legacy restrictions from page.page_restrictions. | |
Public Attributes | |
const | CONSTRUCTOR_OPTIONS |
Private Member Functions | |
convertOldRestrictions (string $oldRestrictions) | |
Given a string formatted like the legacy page.page_restrictions field, return an array of restrictions in the format returned by getAllRestrictions(). | |
getCascadeProtectionSourcesInternal (PageIdentity $page, bool $shortCircuit=false) | |
Cascading protection: Get the source of any cascading restrictions on this page. | |
getCreateProtectionInternal (PageIdentity $page) | |
Fetch title protection settings. | |
Private Attributes | |
array[] | $cache = [] |
Caching various restrictions data in the following format: cache key => [ string[] restrictions => restrictions loaded for pages string oldRestrictions => legacy-formatted restrictions from page.page_restrictions ?string expiry => restrictions expiry data for pages ?array create_protection => value for getCreateProtection bool cascade => cascade restrictions on this page to included templates and images? array[] cascade_sources => the results of getCascadeProtectionSources bool has_cascading => Are cascading restrictions in effect on this page? ]. | |
CommentStore | $commentStore |
HookContainer | $hookContainer |
HookRunner | $hookRunner |
LinkCache | $linkCache |
ILoadBalancer | $loadBalancer |
ServiceOptions | $options |
PageStore | $pageStore |
WANObjectCache | $wanCache |
MediaWiki\Permissions\RestrictionStore::__construct | ( | ServiceOptions | $options, |
WANObjectCache | $wanCache, | ||
ILoadBalancer | $loadBalancer, | ||
LinkCache | $linkCache, | ||
CommentStore | $commentStore, | ||
HookContainer | $hookContainer, | ||
PageStore | $pageStore | ||
) |
ServiceOptions | $options | |
WANObjectCache | $wanCache | |
ILoadBalancer | $loadBalancer | |
LinkCache | $linkCache | |
CommentStore | $commentStore | |
HookContainer | $hookContainer | |
PageStore | $pageStore |
Definition at line 85 of file RestrictionStore.php.
References MediaWiki\Permissions\RestrictionStore\$commentStore, MediaWiki\Permissions\RestrictionStore\$hookContainer, MediaWiki\Permissions\RestrictionStore\$linkCache, MediaWiki\Permissions\RestrictionStore\$loadBalancer, MediaWiki\Permissions\RestrictionStore\$options, MediaWiki\Permissions\RestrictionStore\$pageStore, MediaWiki\Permissions\RestrictionStore\$wanCache, and MediaWiki\Config\ServiceOptions\assertRequiredOptions().
MediaWiki\Permissions\RestrictionStore::areCascadeProtectionSourcesLoaded | ( | PageIdentity | $page | ) |
Determines whether cascading protection sources have already been loaded from the database.
PageIdentity | $page | Must be local |
Definition at line 700 of file RestrictionStore.php.
MediaWiki\Permissions\RestrictionStore::areRestrictionsCascading | ( | PageIdentity | $page | ) |
Checks if restrictions are cascading for the current page.
PageIdentity | $page | Must be local |
Definition at line 712 of file RestrictionStore.php.
MediaWiki\Permissions\RestrictionStore::areRestrictionsLoaded | ( | PageIdentity | $page | ) |
PageIdentity | $page | Must be local |
Definition at line 688 of file RestrictionStore.php.
|
private |
Given a string formatted like the legacy page.page_restrictions field, return an array of restrictions in the format returned by getAllRestrictions().
string | $oldRestrictions | Restrictions in legacy format (page.page_restrictions). Example: "edit=autoconfirmed,sysop:move=sysop" |
Definition at line 511 of file RestrictionStore.php.
MediaWiki\Permissions\RestrictionStore::deleteCreateProtection | ( | PageIdentity | $page | ) |
Remove any title creation protection due to page existing.
PageIdentity | $page | Must be local |
Definition at line 193 of file RestrictionStore.php.
MediaWiki\Permissions\RestrictionStore::flushRestrictions | ( | PageIdentity | $page | ) |
Flush the protection cache in this object and force reload from the database.
This is used when updating protection from WikiPage::doUpdateRestrictions().
PageIdentity | $page | Must be local |
Definition at line 728 of file RestrictionStore.php.
MediaWiki\Permissions\RestrictionStore::getAllRestrictions | ( | PageIdentity | $page | ) |
Returns the restricted actions and their restrictions for the specified page.
PageIdentity | $page | Must be local |
Definition at line 130 of file RestrictionStore.php.
MediaWiki\Permissions\RestrictionStore::getCascadeProtectionSources | ( | PageIdentity | $page | ) |
Cascading protection: Get the source of any cascading restrictions on this page.
PageIdentity | $page | Must be local |
Definition at line 590 of file RestrictionStore.php.
|
private |
Cascading protection: Get the source of any cascading restrictions on this page.
PageIdentity | $page | Must be local |
bool | $shortCircuit | If true, just return true or false instead of the actual lists. |
Definition at line 604 of file RestrictionStore.php.
References $dbr, $res, DB_REPLICA, MediaWiki\Page\PageReference\getDBkey(), MediaWiki\Page\PageReference\getNamespace(), NS_FILE, and wfTimestampNow().
MediaWiki\Permissions\RestrictionStore::getCreateProtection | ( | PageIdentity | $page | ) |
Is this title subject to protection against creation?
PageIdentity | $page | Must be local |
Definition at line 171 of file RestrictionStore.php.
|
private |
Fetch title protection settings.
To work correctly, $this->loadRestrictions() needs to have access to the actual protections in the database without munging 'sysop' => 'editprotected' and 'autoconfirmed' => 'editsemiprotected'.
PageIdentity | $page | Must be local |
Definition at line 539 of file RestrictionStore.php.
MediaWiki\Permissions\RestrictionStore::getRestrictionExpiry | ( | PageIdentity | $page, |
string | $action | ||
) |
Get the expiry time for the restriction against a given action.
PageIdentity | $page | Must be local |
string | $action |
Definition at line 148 of file RestrictionStore.php.
MediaWiki\Permissions\RestrictionStore::getRestrictions | ( | PageIdentity | $page, |
string | $action | ||
) |
Returns list of restrictions for specified page.
PageIdentity | $page | Must be local |
string | $action | Action that restrictions need to be checked for |
Definition at line 116 of file RestrictionStore.php.
MediaWiki\Permissions\RestrictionStore::isCascadeProtected | ( | PageIdentity | $page | ) |
Cascading protection: Return true if cascading restrictions apply to this page, false if not.
PageIdentity | $page | Must be local |
Definition at line 280 of file RestrictionStore.php.
MediaWiki\Permissions\RestrictionStore::isProtected | ( | PageIdentity | $page, |
string | $action = '' |
||
) |
Does the title correspond to a protected article?
PageIdentity | $page | Must be local |
string | $action | The action the page is protected from, by default checks all actions. |
Definition at line 241 of file RestrictionStore.php.
MediaWiki\Permissions\RestrictionStore::isSemiProtected | ( | PageIdentity | $page, |
string | $action = 'edit' |
||
) |
Is this page "semi-protected" - the only protection levels are listed in $wgSemiprotectedRestrictionLevels?
PageIdentity | $page | Must be local |
string | $action | Action to check (default: edit) |
Definition at line 213 of file RestrictionStore.php.
MediaWiki\Permissions\RestrictionStore::listAllRestrictionTypes | ( | bool | $exists = true | ) |
Get a filtered list of all restriction types supported by this wiki.
bool | $exists | True to get all restriction types that apply to titles that do exist, false for all restriction types that apply to titles that do not exist |
Definition at line 321 of file RestrictionStore.php.
MediaWiki\Permissions\RestrictionStore::listApplicableRestrictionTypes | ( | PageIdentity | $page | ) |
Returns restriction types for the current page.
PageIdentity | $page | Must be local |
Definition at line 292 of file RestrictionStore.php.
MediaWiki\Permissions\RestrictionStore::loadRestrictions | ( | PageIdentity | $page, |
int | $flags = IDBAccessObject::READ_NORMAL , |
||
?string | $oldRestrictions = null |
||
) |
Load restrictions from page.page_restrictions and the page_restrictions table.
PageIdentity | $page | Must be local |
int | $flags | IDBAccessObject::READ_XXX constants (e.g., READ_LATEST to read from primary DB) |
string | null | $oldRestrictions | Restrictions in legacy format (page.page_restrictions). null means we don't know about any legacy restrictions and they need to be looked up. Example: "edit=autoconfirmed,sysop:move=sysop" |
Definition at line 343 of file RestrictionStore.php.
MediaWiki\Permissions\RestrictionStore::loadRestrictionsFromRows | ( | PageIdentity | $page, |
array | $rows, | ||
?string | $oldRestrictions = null |
||
) |
Compiles list of active page restrictions for this existing page.
Public for usage by LiquidThreads.
PageIdentity | $page | Must be local |
stdClass[] | $rows | Array of db result objects |
string | null | $oldRestrictions | Restrictions in legacy format (page.page_restrictions). null means we don't know about any legacy restrictions and they need to be looked up. Example: "edit=autoconfirmed,sysop:move=sysop" |
Definition at line 436 of file RestrictionStore.php.
MediaWiki\Permissions\RestrictionStore::registerOldRestrictions | ( | PageIdentity | $page, |
string | $oldRestrictions | ||
) |
Register legacy restrictions from page.page_restrictions.
This is nice to do if you have a page row handy anyway, so we don't have to look them up separately later.
PageIdentity | $page | Must be local |
string | $oldRestrictions | Restrictions in legacy format (page.page_restrictions). Example: "edit=autoconfirmed,sysop:move=sysop" |
Definition at line 744 of file RestrictionStore.php.
|
private |
Caching various restrictions data in the following format: cache key => [ string[] restrictions
=> restrictions loaded for pages string oldRestrictions
=> legacy-formatted restrictions from page.page_restrictions ?string expiry
=> restrictions expiry data for pages ?array create_protection
=> value for getCreateProtection bool cascade
=> cascade restrictions on this page to included templates and images? array[] cascade_sources
=> the results of getCascadeProtectionSources bool has_cascading
=> Are cascading restrictions in effect on this page? ].
Definition at line 74 of file RestrictionStore.php.
|
private |
Definition at line 51 of file RestrictionStore.php.
Referenced by MediaWiki\Permissions\RestrictionStore\__construct().
|
private |
Definition at line 54 of file RestrictionStore.php.
Referenced by MediaWiki\Permissions\RestrictionStore\__construct().
|
private |
Definition at line 57 of file RestrictionStore.php.
|
private |
Definition at line 48 of file RestrictionStore.php.
Referenced by MediaWiki\Permissions\RestrictionStore\__construct().
|
private |
Definition at line 45 of file RestrictionStore.php.
Referenced by MediaWiki\Permissions\RestrictionStore\__construct().
|
private |
Definition at line 39 of file RestrictionStore.php.
Referenced by MediaWiki\Permissions\RestrictionStore\__construct().
|
private |
Definition at line 60 of file RestrictionStore.php.
Referenced by MediaWiki\Permissions\RestrictionStore\__construct().
|
private |
Definition at line 42 of file RestrictionStore.php.
Referenced by MediaWiki\Permissions\RestrictionStore\__construct().
const MediaWiki\Permissions\RestrictionStore::CONSTRUCTOR_OPTIONS |
Definition at line 31 of file RestrictionStore.php.