MediaWiki REL1_35
|
Handles the page protection UI and backend. More...
Public Member Functions | |
__construct (Article $article) | |
execute () | |
Main entry point for action=protect and action=unprotect. | |
Protected Attributes | |
bool | $disabled |
array | $disabledAttrib |
array | $mApplicableTypes = [] |
Types (i.e. | |
Article | $mArticle |
bool | $mCascade = false |
True if the restrictions are cascading, from request or existing protection. | |
array | $mExistingExpiry = [] |
Map of action to the expiry time of the existing protection. | |
array | $mExpiry = [] |
Map of action to "other" expiry time. | |
array | $mExpirySelection = [] |
Map of action to value selected in expiry drop-down list. | |
array | $mPermErrors = [] |
Permissions errors for the protect action. | |
string | $mReason = '' |
The custom/additional protection reason. | |
string | $mReasonSelection = '' |
The reason selected from the list, blank for other/additional. | |
array | $mRestrictions = [] |
A map of action to restriction level, from request or default. | |
Title | $mTitle |
Private Member Functions | |
buildForm () | |
Build the input form. | |
buildSelector ( $action, $selected) | |
Build protection level selector. | |
getExpiry ( $action) | |
Get the expiry time for a given action, by combining the relevant inputs. | |
getOptionLabel ( $permission) | |
Prepare the label for a protection selector option. | |
loadData () | |
Loads the current state of protection into the object. | |
save () | |
Save submitted protection form. | |
show ( $err=null) | |
Show the input form with optional error message. | |
showLogExtract (OutputPage $out) | |
Show protection long extracts for this page. | |
Private Attributes | |
HookRunner | $hookRunner |
IContextSource | $mContext |
PermissionManager | $permManager |
Handles the page protection UI and backend.
Definition at line 33 of file ProtectionForm.php.
ProtectionForm::__construct | ( | Article | $article | ) |
Definition at line 85 of file ProtectionForm.php.
References Article\getContext(), Article\getTitle(), loadData(), wfReadOnly(), and wfReadOnlyReason().
|
private |
Build the input form.
Definition at line 386 of file ProtectionForm.php.
References $disabled, $disabledAttrib, $lang, $mContext, $t, buildSelector(), IContextSource\getUser(), XmlSelect\parseOptionsMessage(), and wfMessage().
Referenced by show().
|
private |
Build protection level selector.
string | $action | Action to protect |
string | $selected | Current protection level |
Definition at line 610 of file ProtectionForm.php.
References getOptionLabel().
Referenced by buildForm().
ProtectionForm::execute | ( | ) |
Main entry point for action=protect and action=unprotect.
Definition at line 209 of file ProtectionForm.php.
|
private |
Get the expiry time for a given action, by combining the relevant inputs.
string | $action |
Definition at line 182 of file ProtectionForm.php.
References wfIsInfinity(), and wfTimestamp().
Referenced by save().
|
private |
Prepare the label for a protection selector option.
string | $permission | Permission required |
Definition at line 639 of file ProtectionForm.php.
Referenced by buildSelector().
|
private |
Loads the current state of protection into the object.
Definition at line 120 of file ProtectionForm.php.
Referenced by __construct().
|
private |
Save submitted protection form.
Definition at line 301 of file ProtectionForm.php.
References $mReason, $mReasonSelection, WatchAction\doWatchOrUnwatch(), getExpiry(), show(), and wfTimestampNow().
Referenced by execute().
|
private |
Show the input form with optional error message.
string | string[] | null | $err | Error message or null if there's no error |
Definition at line 233 of file ProtectionForm.php.
References $title, buildForm(), showLogExtract(), and wfEscapeWikiText().
|
private |
Show protection long extracts for this page.
OutputPage | $out |
Definition at line 657 of file ProtectionForm.php.
References OutputPage\addHTML().
Referenced by show().
|
protected |
Definition at line 71 of file ProtectionForm.php.
Referenced by buildForm().
|
protected |
Definition at line 74 of file ProtectionForm.php.
Referenced by buildForm().
|
private |
Definition at line 83 of file ProtectionForm.php.
|
protected |
Types (i.e.
actions) for which levels can be selected
Definition at line 59 of file ProtectionForm.php.
|
protected |
Definition at line 65 of file ProtectionForm.php.
|
protected |
True if the restrictions are cascading, from request or existing protection.
Definition at line 44 of file ProtectionForm.php.
|
private |
Definition at line 77 of file ProtectionForm.php.
Referenced by buildForm().
|
protected |
Map of action to the expiry time of the existing protection.
Definition at line 62 of file ProtectionForm.php.
|
protected |
Map of action to "other" expiry time.
Used in preference to mExpirySelection.
Definition at line 47 of file ProtectionForm.php.
|
protected |
Map of action to value selected in expiry drop-down list.
Will be set to 'othertime' whenever mExpiry is set.
Definition at line 53 of file ProtectionForm.php.
|
protected |
Permissions errors for the protect action.
Definition at line 56 of file ProtectionForm.php.
|
protected |
The custom/additional protection reason.
Definition at line 38 of file ProtectionForm.php.
Referenced by save().
|
protected |
The reason selected from the list, blank for other/additional.
Definition at line 41 of file ProtectionForm.php.
Referenced by save().
|
protected |
A map of action to restriction level, from request or default.
Definition at line 35 of file ProtectionForm.php.
|
protected |
Definition at line 68 of file ProtectionForm.php.
|
private |
Definition at line 80 of file ProtectionForm.php.