MediaWiki
1.23.2
|
Actions are things which can be done to pages (edit, delete, rollback, etc). More...
Public Member Functions | |
__construct (Page $page, IContextSource $context=null) | |
Constructor. More... | |
execute () | |
Execute the action in a silent fashion: do not display anything or release any errors. More... | |
getContext () | |
Get the IContextSource in use here. More... | |
getLang () | |
Shortcut to get the user Language being used for this instance. 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... | |
msg () | |
Get a Message object with context set Parameters are the same as wfMessage() 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... | |
show () | |
The main action entry point. More... | |
Static Public Member Functions | |
static | exists ( $name) |
Check if a given action is recognised, even if it's disabled. More... | |
static | factory ( $action, Page $page, 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> tag. More... | |
getPageTitle () | |
Returns the name that goes in the <h1> page title. More... | |
setHeaders () | |
Set output headers for noindexing etc. More... | |
Protected Attributes | |
IContextSource | $context |
IContextSource if specified; otherwise we'll use the Context from the Page $context. More... | |
array | $fields |
The fields used to create the HTMLForm $fields. More... | |
WikiPage Article ImagePage CategoryPage Page | $page |
Page on which we're performing the action $page. More... | |
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. 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. There is also the deprecated UnknownAction hook
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 37 of file Action.php.
Action::__construct | ( | Page | $page, |
IContextSource | $context = null |
||
) |
Constructor.
Only public since 1.21
Page | $page | |
IContextSource | $context |
Definition at line 260 of file Action.php.
|
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 WatchAction, and RevertFileAction.
Definition at line 295 of file Action.php.
References $right, $user, getRestriction(), getTitle(), User\isBlocked(), requiresUnblock(), requiresWrite(), and wfReadOnly().
Referenced by FormlessAction\execute(), FormAction\execute(), FormlessAction\show(), PurgeAction\show(), and FormAction\show().
|
abstract |
Execute the action in a silent fashion: do not display anything or release any errors.
Reimplemented in RevertAction.
|
staticfinal |
Check if a given action is recognised, even if it's disabled.
string | $name | Name of an action |
Definition at line 156 of file Action.php.
References $name, array(), and getClass().
Referenced by HistoryAction\fetchRevisions().
|
staticfinal |
Get an appropriate Action subclass for the given action.
string | $action | |
Page | $page | |
IContextSource | $context |
Definition at line 88 of file Action.php.
References $context, $page, array(), WikiPage\getActionOverrides(), and getClass().
Referenced by getActionName(), Article\info(), MediaWiki\performAction(), SkinTemplate\prepareQuickTemplate(), Article\purge(), Article\revert(), and Article\rollback().
|
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 112 of file Action.php.
References $context, IContextSource\canUseWikiPage(), factory(), IContextSource\getRequest(), IContextSource\getWikiPage(), and global.
Referenced by SkinTemplate\buildContentNavigationUrls(), MediaWiki\getAction(), OutputPage\getJSVars(), OutputPage\headElement(), and SkinTemplate\prepareQuickTemplate().
|
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 61 of file Action.php.
References global.
|
final |
Get the IContextSource in use here.
Definition at line 164 of file Action.php.
References $context, RequestContext\getMain(), page, wfDebug(), and wfWarn().
Referenced by RawPage\__construct(), FormlessAction\execute(), FormAction\execute(), FormAction\getForm(), getLanguage(), getOutput(), RawAction\getRawText(), getRequest(), getSkin(), getUser(), msg(), RollbackAction\onView(), InfoAction\onView(), HistoryAction\onView(), and RevisiondeleteAction\show().
|
protected |
Returns the description that goes below the <h1> tag.
Reimplemented in InfoAction, UnwatchAction, RevertFileAction, RollbackAction, HistoryAction, PurgeAction, RevisiondeleteAction, WatchAction, MarkpatrolledAction, and CreditsAction.
Definition at line 360 of file Action.php.
References getName(), and msg().
Referenced by setHeaders().
|
final |
Shortcut to get the user Language being used for this instance.
Definition at line 228 of file Action.php.
References getLanguage(), and wfDeprecated().
|
final |
Shortcut to get the user Language being used for this instance.
Definition at line 218 of file Action.php.
References getContext().
Referenced by CreditsAction\getAuthor(), CachedAction\getCacheKey(), CreditsAction\getContributors(), InfoAction\getContributors(), RevertFileAction\getFormFields(), getLang(), RevertFileAction\onSuccess(), and InfoAction\pageInfo().
|
abstract |
Return the name of the action this object responds to.
Reimplemented in UnwatchAction, SubmitAction, UnprotectAction, RevertFileAction, HistoryAction, InfoAction, RawAction, EditAction, DeleteAction, ProtectAction, PurgeAction, RenderAction, ViewAction, RevertAction, RevisiondeleteAction, MarkpatrolledAction, CreditsAction, RollbackAction, and WatchAction.
Referenced by CachedAction\getCacheKey(), getDescription(), and FormAction\getForm().
|
final |
Get the OutputPage being used for this instance.
Definition at line 191 of file Action.php.
References getContext().
Referenced by CachedAction\addCachedHTML(), RevertFileAction\getDescription(), CachedAction\onCacheInitialized(), PurgeAction\onSuccess(), RevertFileAction\onSuccess(), WatchAction\onSuccess(), UnwatchAction\onSuccess(), RollbackAction\onView(), MarkpatrolledAction\onView(), RawAction\onView(), HistoryAction\onView(), setHeaders(), RevertAction\show(), and FormlessAction\show().
|
protected |
Returns the name that goes in the <h1> page title.
Reimplemented in InfoAction, RevertFileAction, and HistoryAction.
Definition at line 351 of file Action.php.
References getTitle().
Referenced by WatchAction\checkCanExecute(), and setHeaders().
|
final |
Get the WebRequest being used for this instance.
Definition at line 182 of file Action.php.
References getContext().
Referenced by RevertFileAction\alterForm(), RevertFileAction\checkCanExecute(), HistoryAction\feed(), RawAction\getContentType(), FormAction\getForm(), RevertFileAction\getFormFields(), RawAction\getOldId(), RawAction\getRawText(), RevertFileAction\onSubmit(), RevertFileAction\onSuccess(), RollbackAction\onView(), MarkpatrolledAction\onView(), RawAction\onView(), HistoryAction\onView(), PurgeAction\show(), and CachedAction\startCache().
Action::getRestriction | ( | ) |
Get the permission required to perform this action.
Often, but not always, the same as the action name
Reimplemented in RevertFileAction, and RollbackAction.
Definition at line 282 of file Action.php.
Referenced by checkCanExecute().
|
final |
Shortcut to get the Skin being used for this instance.
Definition at line 209 of file Action.php.
References getContext().
|
final |
Shortcut to get the Title object from the page.
Definition at line 237 of file Action.php.
References page.
Referenced by RevertFileAction\checkCanExecute(), checkCanExecute(), HistoryAction\feed(), HistoryAction\feedEmpty(), HistoryAction\feedItem(), HistoryAction\fetchRevisions(), HistoryAction\getDescription(), RevertFileAction\getDescription(), RevertFileAction\getFormFields(), RawAction\getOldId(), HistoryAction\getPageTitle(), RevertFileAction\getPageTitle(), getPageTitle(), InfoAction\getPageTitle(), RawAction\getRawText(), WatchAction\onSubmit(), UnwatchAction\onSubmit(), PurgeAction\onSuccess(), RevertFileAction\onSuccess(), WatchAction\onSuccess(), UnwatchAction\onSuccess(), RollbackAction\onView(), HistoryAction\onView(), CreditsAction\othersLink(), InfoAction\pageInfo(), and WatchAction\show().
|
final |
Shortcut to get the User being used for this instance.
Definition at line 200 of file Action.php.
References getContext().
Referenced by FormlessAction\execute(), FormAction\execute(), RevertFileAction\getFormFields(), WatchAction\onSubmit(), RevertFileAction\onSubmit(), UnwatchAction\onSubmit(), RevertFileAction\onSuccess(), RollbackAction\onView(), MarkpatrolledAction\onView(), RawAction\onView(), HistoryAction\onView(), InfoAction\pageInfo(), EditAction\show(), FormlessAction\show(), WatchAction\show(), PurgeAction\show(), and FormAction\show().
|
final |
Get a Message object with context set Parameters are the same as wfMessage()
Definition at line 247 of file Action.php.
References $params, array(), and getContext().
Referenced by WatchAction\checkCanExecute(), HistoryAction\feed(), HistoryAction\feedEmpty(), HistoryAction\feedItem(), CreditsAction\getAuthor(), CreditsAction\getContributors(), InfoAction\getContributors(), CreditsAction\getDescription(), WatchAction\getDescription(), HistoryAction\getDescription(), UnwatchAction\getDescription(), getDescription(), RevertFileAction\getFormFields(), HistoryAction\getPageTitle(), RevertFileAction\getPageTitle(), InfoAction\getPageTitle(), RollbackAction\onView(), MarkpatrolledAction\onView(), CreditsAction\onView(), InfoAction\onView(), HistoryAction\onView(), CreditsAction\othersLink(), InfoAction\pageInfo(), PurgeAction\postText(), HistoryAction\preCacheMessages(), PurgeAction\preText(), WatchAction\preText(), UnwatchAction\preText(), and CreditsAction\userLink().
Action::requiresUnblock | ( | ) |
Whether this action can still be executed by a blocked user.
Reimplemented in HistoryAction, InfoAction, RawAction, PurgeAction, RevisiondeleteAction, and WatchAction.
Definition at line 330 of file Action.php.
Referenced by checkCanExecute().
Action::requiresWrite | ( | ) |
Whether this action requires the wiki not to be locked.
Reimplemented in InfoAction, HistoryAction, and RawAction.
Definition at line 322 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 338 of file Action.php.
References $out, getDescription(), getOutput(), and getPageTitle().
Referenced by FormlessAction\show(), WatchAction\show(), PurgeAction\show(), and FormAction\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 FormAction, SubmitAction, PurgeAction, UnprotectAction, FormlessAction, WatchAction, RevisiondeleteAction, EditAction, DeleteAction, ProtectAction, RenderAction, ViewAction, and RevertAction.
|
protected |
IContextSource if specified; otherwise we'll use the Context from the Page $context.
Definition at line 47 of file Action.php.
Referenced by __construct(), RawPage\__construct(), factory(), getActionName(), and getContext().
|
protected |
The fields used to create the HTMLForm $fields.
Definition at line 52 of file Action.php.
Referenced by FormAction\execute().
|
protected |
Page on which we're performing the action $page.
Definition at line 42 of file Action.php.
Referenced by __construct(), RawPage\__construct(), WatchAction\doUnwatch(), WatchAction\doWatch(), factory(), HistoryAction\getArticle(), CreditsAction\getAuthor(), InfoAction\getContributors(), CreditsAction\link(), and EditAction\show().