MediaWiki REL1_33
|
Actions are things which can be done to pages (edit, delete, rollback, etc). More...
Public Member Functions | |
__construct (Page $page, IContextSource $context=null) | |
Only public since 1.21. | |
addHelpLink ( $to, $overrideBaseUrl=false) | |
Adds help link with an icon via page indicators. | |
doesWrites () | |
Indicates whether this action may perform database writes. | |
getContext () | |
Get the IContextSource in use here. | |
getLanguage () | |
Shortcut to get the user Language being used for this instance. | |
getName () | |
Return the name of the action this object responds to. | |
getOutput () | |
Get the OutputPage being used for this instance. | |
getRequest () | |
Get the WebRequest being used for this instance. | |
getRestriction () | |
Get the permission required to perform this action. | |
getSkin () | |
Shortcut to get the Skin being used for this instance. | |
getTitle () | |
Shortcut to get the Title object from the page. | |
getUser () | |
Shortcut to get the User being used for this instance. | |
msg ( $key) | |
Get a Message object with context set Parameters are the same as wfMessage() | |
requiresUnblock () | |
Whether this action can still be executed by a blocked user. | |
requiresWrite () | |
Whether this action requires the wiki not to be locked. | |
show () | |
The main action entry point. | |
Static Public Member Functions | |
static | exists ( $name) |
Check if a given action is recognised, even if it's disabled. | |
static | factory ( $action, Page $page, IContextSource $context=null) |
Get an appropriate Action subclass for the given action. | |
static | getActionName (IContextSource $context) |
Get the action that will be executed, not necessarily the one passed passed through the "action" request parameter. | |
Protected Member Functions | |
checkCanExecute (User $user) | |
Checks if the given user (identified by an object) can perform this action. | |
getDescription () | |
Returns the description that goes below the \<h1\> tag. | |
getPageTitle () | |
Returns the name that goes in the \<h1\> page title. | |
setHeaders () | |
Set output headers for noindexing etc. | |
useTransactionalTimeLimit () | |
Call wfTransactionalTimeLimit() if this request was POSTed. | |
Protected Attributes | |
$context | |
IContextSource if specified; otherwise we'll use the Context from the Page. | |
$fields | |
The fields used to create the HTMLForm. | |
$page | |
Page on which we're performing the action. | |
Static Private Member Functions | |
static | getClass ( $action, array $overrides) |
Get the Action subclass which should be used to handle this action, false if the action is disabled, or null if it's not recognised. | |
Actions are things which can be done to pages (edit, delete, rollback, etc).
They are distinct from Special Pages because an action must apply to exactly one page.
To add an action in an extension, create a subclass of Action, and add the key to $wgActions.
Actions generally fall into two groups: the show-a-form-then-do-something-with-the-input format (protect, delete, move, etc), and the just-do-something format (watch, rollback, patrol, etc). The FormAction and FormlessAction classes represent these two groups.
Definition at line 39 of file Action.php.
Action::__construct | ( | Page | $page, |
IContextSource | $context = null ) |
Only public since 1.21.
Page | $page | |
IContextSource | null | $context |
Definition at line 268 of file Action.php.
Action::addHelpLink | ( | $to, | |
$overrideBaseUrl = false ) |
Adds help link with an icon via page indicators.
Link target can be overridden by a local message containing a wikilink: the message key is: lowercase action name + '-helppage'.
string | $to | Target MediaWiki.org page title or encoded URL. |
bool | $overrideBaseUrl | Whether $url is a full URL, to avoid MW.o. |
Definition at line 394 of file Action.php.
References getContext(), getOutput(), and wfMessage().
Referenced by HistoryAction\onView(), and DeleteAction\show().
|
protected |
Checks if the given user (identified by an object) can perform this action.
Can be overridden by sub-classes with more complicated permissions schemes. Failures here must throw subclasses of ErrorPageError
User | $user | The user to check, or null to use the context user |
UserBlockedError|ReadOnlyError|PermissionsError |
Reimplemented in McrUndoAction, RevertAction, and WatchAction.
Definition at line 307 of file Action.php.
References getName(), getRestriction(), getTitle(), requiresUnblock(), requiresWrite(), and wfReadOnly().
Referenced by DummyAction\canExecute(), FormAction\show(), FormlessAction\show(), and PurgeAction\show().
Action::doesWrites | ( | ) |
Indicates whether this action may perform database writes.
Reimplemented in DeleteAction, EditAction, FormAction, MarkpatrolledAction, ProtectAction, PurgeAction, RevertAction, RollbackAction, SpecialPageAction, UnprotectAction, UnwatchAction, and WatchAction.
Definition at line 432 of file Action.php.
|
staticfinal |
Check if a given action is recognised, even if it's disabled.
string | $name | Name of an action |
Definition at line 170 of file Action.php.
Referenced by MediaWiki\Permissions\PermissionManager\checkUserBlock(), and HistoryAction\fetchRevisions().
|
staticfinal |
Get an appropriate Action subclass for the given action.
string | $action | |
Page | $page | |
IContextSource | null | $context |
Definition at line 97 of file Action.php.
References $context, and and().
Referenced by MediaWiki\Permissions\PermissionManager\checkUserBlock().
|
staticfinal |
Get the action that will be executed, not necessarily the one passed passed through the "action" request parameter.
Actions disabled in $wgActions will be replaced by "nosuchaction".
IContextSource | $context |
Definition at line 123 of file Action.php.
References $context, $request, $wgActions, and and().
|
staticfinalprivate |
Get the Action subclass which should be used to handle this action, false if the action is disabled, or null if it's not recognised.
string | $action | |
array | $overrides |
Definition at line 69 of file Action.php.
References $wgActions, and and().
|
final |
Get the IContextSource in use here.
Definition at line 179 of file Action.php.
References $context, and(), wfDebug(), and wfWarn().
Referenced by HistoryAction\getDescription(), FormAction\getForm(), RawAction\getRawText(), RollbackAction\handleRollbackRequest(), HistoryAction\onView(), InfoAction\onView(), InfoAction\pageInfo(), EditAction\show(), McrUndoAction\show(), ProtectAction\show(), and SpecialPageAction\show().
|
protected |
Returns the description that goes below the \<h1\> tag.
Reimplemented in CreditsAction, HistoryAction, InfoAction, MarkpatrolledAction, McrRestoreAction, McrUndoAction, PurgeAction, RevertAction, RollbackAction, SpecialPageAction, and WatchAction.
Definition at line 382 of file Action.php.
References and(), getName(), and msg().
Referenced by setHeaders().
|
final |
Shortcut to get the user Language being used for this instance.
Definition at line 237 of file Action.php.
References getContext().
Referenced by CreditsAction\getAuthor(), CachedAction\getCacheKey(), CreditsAction\getContributors(), InfoAction\getContributors(), HistoryAction\getDescription(), RevertAction\getFormFields(), RevertAction\onSuccess(), and InfoAction\pageInfo().
|
abstract |
Return the name of the action this object responds to.
Reimplemented in CreditsAction, DeleteAction, EditAction, HistoryAction, InfoAction, MarkpatrolledAction, McrRestoreAction, McrUndoAction, ProtectAction, PurgeAction, RawAction, RenderAction, RevertAction, RollbackAction, SpecialPageAction, SubmitAction, UnprotectAction, UnwatchAction, ViewAction, WatchAction, and DummyAction.
Referenced by checkCanExecute(), CachedAction\getCacheKey(), getDescription(), and FormAction\getForm().
|
final |
Get the OutputPage being used for this instance.
Definition at line 208 of file Action.php.
References getContext().
Referenced by CachedAction\addCachedHTML(), addHelpLink(), RollbackAction\handleRollbackRequest(), CachedAction\onCacheInitialized(), MarkpatrolledAction\onSubmit(), McrUndoAction\onSuccess(), PurgeAction\onSuccess(), RevertAction\onSuccess(), UnwatchAction\onSuccess(), WatchAction\onSuccess(), HistoryAction\onView(), RawAction\onView(), setHeaders(), EditAction\show(), FormlessAction\show(), McrUndoAction\show(), ProtectAction\show(), ViewAction\show(), and McrUndoAction\showPreview().
|
protected |
Returns the name that goes in the \<h1\> page title.
Reimplemented in HistoryAction, InfoAction, and RevertAction.
Definition at line 372 of file Action.php.
References getTitle().
Referenced by setHeaders().
|
final |
Get the WebRequest being used for this instance.
Definition at line 198 of file Action.php.
References getContext().
Referenced by MarkpatrolledAction\alterForm(), RevertAction\alterForm(), RollbackAction\alterForm(), RevertAction\checkCanExecute(), RollbackAction\enableTransactionalTimelimit(), HistoryAction\feed(), McrUndoAction\generateDiffOrPreview(), RawAction\getContentType(), FormAction\getForm(), McrUndoAction\getFormFields(), SpecialPageAction\getName(), RawAction\getOldId(), RawAction\getRawText(), MarkpatrolledAction\getRecentChange(), RollbackAction\handleRollbackRequest(), McrRestoreAction\initFromParameters(), McrUndoAction\initFromParameters(), McrUndoAction\onSubmit(), RevertAction\onSubmit(), HistoryAction\onView(), RawAction\onView(), McrUndoAction\show(), PurgeAction\show(), RollbackAction\show(), CachedAction\startCache(), and useTransactionalTimeLimit().
Action::getRestriction | ( | ) |
Get the permission required to perform this action.
Often, but not always, the same as the action name
Reimplemented in MarkpatrolledAction, RevertAction, RollbackAction, and ControlledAccessDummyAction.
Definition at line 294 of file Action.php.
Referenced by checkCanExecute().
|
final |
Shortcut to get the Skin being used for this instance.
Definition at line 228 of file Action.php.
References getContext().
|
final |
Shortcut to get the Title object from the page.
Definition at line 247 of file Action.php.
Referenced by McrUndoAction\alterForm(), RevertAction\alterForm(), checkCanExecute(), RevertAction\checkCanExecute(), HistoryAction\feed(), HistoryAction\feedEmpty(), HistoryAction\feedItem(), HistoryAction\fetchRevisions(), HistoryAction\getDescription(), RevertAction\getDescription(), FormAction\getForm(), RevertAction\getFormFields(), RawAction\getOldId(), getPageTitle(), HistoryAction\getPageTitle(), InfoAction\getPageTitle(), RevertAction\getPageTitle(), RawAction\getRawText(), RollbackAction\handleRollbackRequest(), McrUndoAction\onSubmit(), RevertAction\onSubmit(), UnwatchAction\onSubmit(), WatchAction\onSubmit(), McrUndoAction\onSuccess(), PurgeAction\onSuccess(), RevertAction\onSuccess(), UnwatchAction\onSuccess(), WatchAction\onSuccess(), HistoryAction\onView(), RawAction\onView(), CreditsAction\othersLink(), InfoAction\pageInfo(), EditAction\show(), McrUndoAction\show(), and McrUndoAction\showPreview().
|
final |
Shortcut to get the User being used for this instance.
Definition at line 218 of file Action.php.
References getContext().
Referenced by RevertAction\getFormFields(), RollbackAction\handleRollbackRequest(), MarkpatrolledAction\onSubmit(), McrUndoAction\onSubmit(), RevertAction\onSubmit(), UnwatchAction\onSubmit(), WatchAction\onSubmit(), RevertAction\onSuccess(), HistoryAction\onView(), RawAction\onView(), InfoAction\pageInfo(), EditAction\show(), FormAction\show(), FormlessAction\show(), PurgeAction\show(), and RollbackAction\show().
|
final |
Get a Message object with context set Parameters are the same as wfMessage()
Implements MessageLocalizer.
Definition at line 257 of file Action.php.
References $params, and(), and getContext().
Referenced by RevertAction\checkCanExecute(), HistoryAction\feed(), HistoryAction\feedEmpty(), HistoryAction\feedItem(), CreditsAction\getAuthor(), CreditsAction\getContributors(), InfoAction\getContributors(), getDescription(), CreditsAction\getDescription(), HistoryAction\getDescription(), PurgeAction\getFormFields(), RevertAction\getFormFields(), RollbackAction\getFormFields(), UnwatchAction\getFormFields(), WatchAction\getFormFields(), HistoryAction\getPageTitle(), InfoAction\getPageTitle(), RevertAction\getPageTitle(), RollbackAction\handleRollbackRequest(), MarkpatrolledAction\onSubmit(), CreditsAction\onView(), HistoryAction\onView(), InfoAction\onView(), CreditsAction\othersLink(), InfoAction\pageInfo(), PurgeAction\postText(), HistoryAction\preCacheMessages(), MarkpatrolledAction\preText(), SpecialPageAction\show(), and CreditsAction\userLink().
Action::requiresUnblock | ( | ) |
Whether this action can still be executed by a blocked user.
Reimplemented in HistoryAction, InfoAction, PurgeAction, RawAction, SpecialPageAction, WatchAction, and RequiresUnblockDummyAction.
Definition at line 350 of file Action.php.
Referenced by checkCanExecute().
Action::requiresWrite | ( | ) |
Whether this action requires the wiki not to be locked.
Reimplemented in HistoryAction, InfoAction, and RawAction.
Definition at line 340 of file Action.php.
Referenced by checkCanExecute().
|
protected |
Set output headers for noindexing etc.
This function will not be called through the execute() entry point, so only put UI-related stuff in here.
Definition at line 359 of file Action.php.
References $out, getDescription(), getOutput(), and getPageTitle().
Referenced by FormAction\show(), FormlessAction\show(), and PurgeAction\show().
|
abstract |
The main action entry point.
Do all output for display and send it to the context output. Do not use globals $wgOut, $wgRequest, etc, in implementations; use $this->getOutput(), etc.
ErrorPageError |
Reimplemented in DeleteAction, EditAction, FormAction, FormlessAction, McrUndoAction, ProtectAction, PurgeAction, RenderAction, RollbackAction, SpecialPageAction, SubmitAction, UnprotectAction, ViewAction, and DummyAction.
|
protected |
Call wfTransactionalTimeLimit() if this request was POSTed.
Definition at line 421 of file Action.php.
References getRequest(), and wfTransactionalTimeLimit().
Referenced by RevertAction\onSubmit(), DeleteAction\show(), EditAction\show(), and McrUndoAction\show().
|
protected |
IContextSource if specified; otherwise we'll use the Context from the Page.
Definition at line 53 of file Action.php.
|
protected |
|
protected |
Page on which we're performing the action.
Definition at line 46 of file Action.php.
Referenced by HistoryAction\getArticle(), and EditAction\show().