MediaWiki
master
|
Actions are things which can be done to pages (edit, delete, rollback, etc). More...
Public Member Functions | |
__construct (Article $article, IContextSource $context) | |
Only public since 1.21. More... | |
addHelpLink ( $to, $overrideBaseUrl=false) | |
Adds help link with an icon via page indicators. More... | |
doesWrites () | |
Indicates whether this action may perform database writes. More... | |
getArticle () | |
Get a Article object. More... | |
getAuthority () | |
Shortcut to get the Authority executing this instance. More... | |
getContext () | |
Get the IContextSource in use here. More... | |
getLanguage () | |
Shortcut to get the user Language being used for this instance. More... | |
getName () | |
Return the name of the action this object responds to. More... | |
getOutput () | |
Get the OutputPage being used for this instance. More... | |
getRequest () | |
Get the WebRequest being used for this instance. More... | |
getRestriction () | |
Get the permission required to perform this action. More... | |
getSkin () | |
Shortcut to get the Skin being used for this instance. More... | |
getTitle () | |
Shortcut to get the Title object from the page. More... | |
getUser () | |
Shortcut to get the User being used for this instance. More... | |
getWikiPage () | |
Get a WikiPage object. More... | |
msg ( $key,... $params) | |
Get a Message object with context set Parameters are the same as wfMessage() More... | |
needsReadRights () | |
Indicates whether this action requires read rights. More... | |
requiresUnblock () | |
Whether this action can still be executed by a blocked user. More... | |
requiresWrite () | |
Whether this action requires the wiki not to be locked. More... | |
setHookContainer (HookContainer $hookContainer) | |
show () | |
The main action entry point. More... | |
Static Public Member Functions | |
static | exists (string $name) |
Check if a given action is recognised, even if it's disabled. More... | |
static | factory (string $action, Article $article, IContextSource $context=null) |
Get an appropriate Action subclass for the given action. More... | |
static | getActionName (IContextSource $context) |
Get the action that will be executed, not necessarily the one passed passed through the "action" request parameter. More... | |
Protected Member Functions | |
checkCanExecute (User $user) | |
Checks if the given user (identified by an object) can perform this action. More... | |
getDescription () | |
Returns the description that goes below the <h1> element. More... | |
getHookContainer () | |
getHookRunner () | |
getPageTitle () | |
Returns the name that goes in the <h1> page title. More... | |
setHeaders () | |
Set output headers for noindexing etc. More... | |
useTransactionalTimeLimit () | |
Call wfTransactionalTimeLimit() if this request was POSTed. More... | |
Protected Attributes | |
IContextSource null | $context |
IContextSource if specified; otherwise we'll use the Context from the Page. More... | |
array | $fields |
The fields used to create the HTMLForm. More... | |
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 44 of file Action.php.
Action::__construct | ( | Article | $article, |
IContextSource | $context | ||
) |
Only public since 1.21.
Article | $article | |
IContextSource | $context |
Reimplemented in MediaWiki\Actions\FileDeleteAction, and DeleteAction.
Definition at line 279 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 427 of file Action.php.
References $lang, $title, and Title\newFromText().
Referenced by InfoAction\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 |
UserBlockedError|ReadOnlyError|PermissionsError |
Reimplemented in WatchAction, RevertAction, and McrUndoAction.
Definition at line 324 of file Action.php.
References User\getBlock(), MediaWiki\Rest\Handler\getRequest(), and getTitle().
Referenced by FormAction\show(), FormlessAction\show(), PurgeAction\show(), and RollbackAction\show().
Action::doesWrites | ( | ) |
Indicates whether this action may perform database writes.
Reimplemented in WatchAction, UnwatchAction, UnprotectAction, SpecialPageAction, RollbackAction, RevertAction, PurgeAction, ProtectAction, MarkpatrolledAction, FormAction, EditAction, and DeleteAction.
Definition at line 468 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 114 of file Action.php.
Referenced by InfoAction\pageInfo().
|
staticfinal |
Get an appropriate Action subclass for the given action.
string | $action | |
Article | $article | |
IContextSource | null | $context | Falls back to article's context |
Definition at line 81 of file Action.php.
References $context, and Article\getContext().
Referenced by RebuildFileCache\execute().
|
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 100 of file Action.php.
References $context, and IContextSource\getActionName().
Action::getArticle | ( | ) |
Get a Article object.
Definition at line 210 of file Action.php.
Referenced by MediaWiki\Actions\FileDeleteAction\__construct(), FormAction\getForm(), InfoAction\onView(), InfoAction\pageInfo(), EditAction\show(), ProtectAction\show(), RenderAction\show(), UnprotectAction\show(), ViewAction\show(), and DeleteAction\tempDelete().
|
final |
Shortcut to get the Authority executing this instance.
Definition at line 170 of file Action.php.
Referenced by RollbackAction\handleRollbackRequest(), MarkpatrolledAction\onSubmit(), McrUndoAction\onSubmit(), RevertAction\onSubmit(), UnwatchAction\onSubmit(), WatchAction\onSubmit(), RawAction\onView(), and InfoAction\pageInfo().
|
final |
Get the IContextSource in use here.
Definition at line 126 of file Action.php.
References wfDebug().
Referenced by WatchAction\__construct(), HistoryAction\getDescription(), FormAction\getForm(), WatchAction\getFormFields(), RawAction\getRawText(), RollbackAction\handleRollbackRequest(), McrUndoAction\onSubmit(), InfoAction\onView(), InfoAction\pageInfo(), EditAction\show(), McrUndoAction\show(), ProtectAction\show(), SpecialPageAction\show(), and DeleteAction\tempDelete().
|
protected |
Returns the description that goes below the <h1>
element.
Reimplemented in WatchAction, SpecialPageAction, RollbackAction, RevertAction, PurgeAction, McrUndoAction, McrRestoreAction, MarkpatrolledAction, InfoAction, HistoryAction, and CreditsAction.
Definition at line 415 of file Action.php.
|
protected |
Definition at line 251 of file Action.php.
|
protected |
Definition at line 264 of file Action.php.
Referenced by HistoryAction\getDescription(), FormAction\getForm(), McrUndoAction\onSubmit(), InfoAction\onView(), RawAction\onView(), and EditAction\show().
|
final |
Shortcut to get the user Language being used for this instance.
Definition at line 189 of file Action.php.
References getContext().
Referenced by CreditsAction\getContributors(), HistoryAction\getDescription(), RevertAction\getFormFields(), RevertAction\onSuccess(), and InfoAction\pageInfo().
|
abstract |
Return the name of the action this object responds to.
Reimplemented in WatchAction, ViewAction, UnwatchAction, UnprotectAction, SubmitAction, SpecialPageAction, RollbackAction, RevertAction, RenderAction, RawAction, PurgeAction, ProtectAction, McrUndoAction, McrRestoreAction, MarkpatrolledAction, InfoAction, HistoryAction, EditAction, DeleteAction, and CreditsAction.
Referenced by FormAction\getForm().
|
final |
Get the OutputPage being used for this instance.
Definition at line 150 of file Action.php.
References getContext().
Referenced by RollbackAction\handleRollbackRequest(), MarkpatrolledAction\onSubmit(), McrUndoAction\onSuccess(), PurgeAction\onSuccess(), RevertAction\onSuccess(), UnwatchAction\onSuccess(), CreditsAction\onView(), HistoryAction\onView(), InfoAction\onView(), RawAction\onView(), EditAction\show(), FormlessAction\show(), McrUndoAction\show(), ProtectAction\show(), and ViewAction\show().
|
protected |
Returns the name that goes in the <h1>
page title.
Reimplemented in RevertAction, InfoAction, and HistoryAction.
Definition at line 404 of file Action.php.
References getTitle().
|
final |
Get the WebRequest being used for this instance.
Definition at line 140 of file Action.php.
References getContext().
Referenced by MediaWiki\Actions\FileDeleteAction\__construct(), MarkpatrolledAction\alterForm(), RevertAction\alterForm(), RollbackAction\alterForm(), RevertAction\checkCanExecute(), RawAction\getContentType(), FormAction\getForm(), McrUndoAction\getFormFields(), RevertAction\getFormFields(), RawAction\getOldId(), RawAction\getRawText(), MarkpatrolledAction\getRecentChange(), RollbackAction\handleRollbackRequest(), McrRestoreAction\initFromParameters(), McrUndoAction\initFromParameters(), McrUndoAction\onSubmit(), RevertAction\onSubmit(), WatchAction\onSubmit(), RevertAction\onSuccess(), HistoryAction\onView(), RawAction\onView(), McrUndoAction\show(), and PurgeAction\show().
Action::getRestriction | ( | ) |
Get the permission required to perform this action.
Often, but not always, the same as the action name
Reimplemented in RollbackAction, RevertAction, McrUndoAction, and MarkpatrolledAction.
Definition at line 300 of file Action.php.
|
final |
Shortcut to get the Skin being used for this instance.
Definition at line 180 of file Action.php.
References getContext().
|
final |
Shortcut to get the Title object from the page.
Definition at line 220 of file Action.php.
Referenced by MediaWiki\Actions\FileDeleteAction\__construct(), WatchAction\__construct(), McrUndoAction\alterForm(), RevertAction\alterForm(), McrUndoAction\checkCanExecute(), RevertAction\checkCanExecute(), HistoryAction\getDescription(), RevertAction\getDescription(), FormAction\getForm(), RevertAction\getFormFields(), HistoryAction\getPageTitle(), RevertAction\getPageTitle(), RawAction\getRawText(), RollbackAction\handleRollbackRequest(), McrUndoAction\onSubmit(), RevertAction\onSubmit(), UnwatchAction\onSubmit(), WatchAction\onSubmit(), McrUndoAction\onSuccess(), PurgeAction\onSuccess(), RevertAction\onSuccess(), UnwatchAction\onSuccess(), RawAction\onView(), CreditsAction\othersLink(), InfoAction\pageInfo(), EditAction\show(), and DeleteAction\tempDelete().
|
final |
Shortcut to get the User being used for this instance.
Definition at line 160 of file Action.php.
References getContext().
Referenced by WatchAction\__construct(), RevertAction\getFormFields(), RollbackAction\handleRollbackRequest(), McrUndoAction\onSubmit(), RevertAction\onSuccess(), RawAction\onView(), InfoAction\pageInfo(), EditAction\show(), FormAction\show(), FormlessAction\show(), PurgeAction\show(), and RollbackAction\show().
|
final |
Get a WikiPage object.
Definition at line 199 of file Action.php.
Referenced by CreditsAction\getContributors(), RawAction\getOldId(), RollbackAction\handleRollbackRequest(), McrRestoreAction\initFromParameters(), McrUndoAction\initFromParameters(), McrUndoAction\onSubmit(), PurgeAction\onSubmit(), CreditsAction\onView(), RawAction\onView(), InfoAction\pageInfo(), ViewAction\show(), and DeleteAction\tempDelete().
|
final |
Get a Message object with context set Parameters are the same as wfMessage()
string | string[] | MessageSpecifier | $key | |
mixed | ...$params |
Implements MessageLocalizer.
Definition at line 232 of file Action.php.
References getContext().
Referenced by RevertAction\checkCanExecute(), CreditsAction\getContributors(), CreditsAction\getDescription(), HistoryAction\getDescription(), PurgeAction\getFormFields(), RevertAction\getFormFields(), RollbackAction\getFormFields(), UnwatchAction\getFormFields(), WatchAction\getFormFields(), HistoryAction\getPageTitle(), RevertAction\getPageTitle(), RollbackAction\handleRollbackRequest(), MarkpatrolledAction\onSubmit(), CreditsAction\onView(), InfoAction\onView(), CreditsAction\othersLink(), InfoAction\pageInfo(), PurgeAction\postText(), MarkpatrolledAction\preText(), SpecialPageAction\show(), DeleteAction\tempDelete(), and CreditsAction\userLink().
Action::needsReadRights | ( | ) |
Indicates whether this action requires read rights.
Reimplemented in ViewAction.
Definition at line 310 of file Action.php.
Action::requiresUnblock | ( | ) |
Whether this action can still be executed by a blocked user.
Reimplemented in WatchAction, SpecialPageAction, RawAction, InfoAction, and HistoryAction.
Definition at line 380 of file Action.php.
Action::requiresWrite | ( | ) |
Whether this action requires the wiki not to be locked.
Reimplemented in RawAction, InfoAction, and HistoryAction.
Definition at line 369 of file Action.php.
|
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 390 of file Action.php.
Referenced by FormAction\show(), FormlessAction\show(), PurgeAction\show(), and RollbackAction\show().
Action::setHookContainer | ( | HookContainer | $hookContainer | ) |
HookContainer | $hookContainer |
Definition at line 241 of file Action.php.
|
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 ViewAction, UnprotectAction, SubmitAction, SpecialPageAction, RollbackAction, RenderAction, PurgeAction, ProtectAction, McrUndoAction, FormlessAction, FormAction, EditAction, and DeleteAction.
|
protected |
Call wfTransactionalTimeLimit() if this request was POSTed.
Definition at line 456 of file Action.php.
References MediaWiki\Rest\Handler\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 57 of file Action.php.
Referenced by DeleteAction\__construct(), MediaWiki\Actions\FileDeleteAction\__construct(), RollbackAction\__construct(), InfoAction\__construct(), RevertAction\__construct(), MarkpatrolledAction\__construct(), CreditsAction\__construct(), RawAction\__construct(), McrUndoAction\__construct(), SpecialPageAction\__construct(), UnwatchAction\__construct(), WatchAction\__construct(), factory(), getActionName(), and DeleteAction\tempDelete().
|
protected |