MediaWiki
REL1_24
|
Actions are things which can be done to pages (edit, delete, rollback, etc). More...
Public Member Functions | |
__construct (Page $page, IContextSource $context=null) | |
Constructor. | |
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 () | |
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. | |
Protected Attributes | |
IContextSource | $context |
IContextSource if specified; otherwise we'll use the Context from the Page. | |
array | $fields |
The fields used to create the HTMLForm. | |
WikiPage Article ImagePage CategoryPage Page | $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. 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 261 of file Action.php.
Action::checkCanExecute | ( | User $ | user | ) | [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 RevertAction.
Definition at line 300 of file Action.php.
Referenced by FormlessAction\show(), PurgeAction\show(), and FormAction\show().
static Action::exists | ( | $ | name | ) | [static, final] |
Check if a given action is recognised, even if it's disabled.
string | $name | Name of an action |
Definition at line 161 of file Action.php.
Referenced by ActionTest\testActionExists(), ActionTest\testActionExists_doesNotRequireInstantiation(), ActionTest\testDisabledAction_exists(), and ActionTest\testNull_doesNotExist().
static Action::factory | ( | $ | action, |
Page $ | page, | ||
IContextSource $ | context = null |
||
) | [static, final] |
Get an appropriate Action subclass for the given action.
string | $action | |
Page | $page | |
IContextSource | $context |
Definition at line 92 of file Action.php.
Referenced by WatchAction\doUnwatch(), WatchAction\doWatch(), InfoAction\invalidateCache(), ActionTest\testActionFactory(), ActionTest\testDisabledAction_factoryReturnsFalse(), and ActionTest\testNull_canNotBeInstantiated().
static Action::getActionName | ( | IContextSource $ | context | ) | [static, final] |
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 116 of file Action.php.
Referenced by ActionTest\testDisabledAction_isNotResolved(), ActionTest\testGetActionName(), ActionTest\testGetActionName_editredlinkWorkaround(), ActionTest\testGetActionName_historysubmitWorkaround(), ActionTest\testGetActionName_revisiondeleteWorkaround(), and ActionTest\testNull_defaultsToView().
static Action::getClass | ( | $ | action, |
array $ | overrides | ||
) | [static, final, private] |
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 64 of file Action.php.
Action::getContext | ( | ) | [final] |
Get the IContextSource in use here.
Definition at line 170 of file Action.php.
Referenced by FormAction\getForm(), RollbackAction\onView(), InfoAction\onView(), ProtectAction\show(), EditAction\show(), DeleteAction\show(), and RevisiondeleteAction\show().
Action::getDescription | ( | ) | [protected] |
Returns the description that goes below the <h1> tag.
Reimplemented in InfoAction, RevertAction, RollbackAction, HistoryAction, PurgeAction, RevisiondeleteAction, WatchAction, MarkpatrolledAction, CreditsAction, and UnwatchAction.
Definition at line 370 of file Action.php.
Action::getLanguage | ( | ) | [final] |
Shortcut to get the user Language being used for this instance.
Definition at line 228 of file Action.php.
Referenced by CreditsAction\getAuthor(), CreditsAction\getContributors(), InfoAction\getContributors(), RevertAction\getFormFields(), RevertAction\onSuccess(), and InfoAction\pageInfo().
Action::getName | ( | ) | [abstract] |
Return the name of the action this object responds to.
Reimplemented in DummyAction, RawAction, HistoryAction, InfoAction, RevertAction, DeleteAction, EditAction, ProtectAction, PurgeAction, RenderAction, UnprotectAction, ViewAction, RevisiondeleteAction, MarkpatrolledAction, CreditsAction, RollbackAction, SubmitAction, UnwatchAction, and WatchAction.
Referenced by FormAction\getForm().
Action::getOutput | ( | ) | [final] |
Get the OutputPage being used for this instance.
Definition at line 199 of file Action.php.
Referenced by RevertAction\getDescription(), UnwatchAction\onSuccess(), PurgeAction\onSuccess(), RevertAction\onSuccess(), WatchAction\onSuccess(), RollbackAction\onView(), MarkpatrolledAction\onView(), RawAction\onView(), FormlessAction\show(), EditAction\show(), DeleteAction\show(), and ProtectAction\show().
Action::getPageTitle | ( | ) | [protected] |
Returns the name that goes in the <h1> page title.
Reimplemented in InfoAction, RevertAction, and HistoryAction.
Definition at line 360 of file Action.php.
Action::getRequest | ( | ) | [final] |
Get the WebRequest being used for this instance.
Definition at line 189 of file Action.php.
Referenced by RevertAction\alterForm(), RevertAction\checkCanExecute(), FormAction\getForm(), RevertAction\getFormFields(), RevertAction\onSubmit(), RevertAction\onSuccess(), RollbackAction\onView(), MarkpatrolledAction\onView(), RawAction\onView(), and PurgeAction\show().
Get the permission required to perform this action.
Often, but not always, the same as the action name
Reimplemented in RevertAction, and RollbackAction.
Definition at line 287 of file Action.php.
Action::getSkin | ( | ) | [final] |
Shortcut to get the Skin being used for this instance.
Definition at line 219 of file Action.php.
Action::getTitle | ( | ) | [final] |
Shortcut to get the Title object from the page.
Definition at line 238 of file Action.php.
Referenced by RevertAction\alterForm(), RevertAction\checkCanExecute(), HistoryAction\feedEmpty(), HistoryAction\getDescription(), RevertAction\getDescription(), RevertAction\getFormFields(), HistoryAction\getPageTitle(), RevertAction\getPageTitle(), InfoAction\getPageTitle(), UnwatchAction\onSubmit(), WatchAction\onSubmit(), UnwatchAction\onSuccess(), PurgeAction\onSuccess(), RevertAction\onSuccess(), WatchAction\onSuccess(), RollbackAction\onView(), CreditsAction\othersLink(), InfoAction\pageInfo(), and WatchAction\show().
Action::getUser | ( | ) | [final] |
Shortcut to get the User being used for this instance.
Definition at line 209 of file Action.php.
Referenced by RevertAction\getFormFields(), UnwatchAction\onSubmit(), WatchAction\onSubmit(), RevertAction\onSubmit(), RevertAction\onSuccess(), RollbackAction\onView(), MarkpatrolledAction\onView(), RawAction\onView(), InfoAction\pageInfo(), FormlessAction\show(), EditAction\show(), WatchAction\show(), PurgeAction\show(), and FormAction\show().
Action::msg | ( | ) | [final] |
Get a Message object with context set Parameters are the same as wfMessage()
Definition at line 248 of file Action.php.
Referenced by RevertAction\checkCanExecute(), HistoryAction\feedEmpty(), CreditsAction\getAuthor(), CreditsAction\getContributors(), InfoAction\getContributors(), UnwatchAction\getDescription(), CreditsAction\getDescription(), WatchAction\getDescription(), HistoryAction\getDescription(), RevertAction\getFormFields(), HistoryAction\getPageTitle(), RevertAction\getPageTitle(), InfoAction\getPageTitle(), RollbackAction\onView(), MarkpatrolledAction\onView(), CreditsAction\onView(), InfoAction\onView(), CreditsAction\othersLink(), InfoAction\pageInfo(), PurgeAction\postText(), UnwatchAction\preText(), PurgeAction\preText(), WatchAction\preText(), and CreditsAction\userLink().
Whether this action can still be executed by a blocked user.
Reimplemented in RawAction, HistoryAction, InfoAction, PurgeAction, RevisiondeleteAction, and WatchAction.
Definition at line 338 of file Action.php.
Whether this action requires the wiki not to be locked.
Reimplemented in InfoAction, RawAction, and HistoryAction.
Definition at line 328 of file Action.php.
Action::setHeaders | ( | ) | [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 347 of file Action.php.
Referenced by FormlessAction\show(), WatchAction\show(), PurgeAction\show(), and FormAction\show().
Action::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 DummyAction, FormAction, PurgeAction, WatchAction, RevisiondeleteAction, DeleteAction, EditAction, ProtectAction, RenderAction, ViewAction, UnprotectAction, FormlessAction, and SubmitAction.
IContextSource Action::$context [protected] |
IContextSource if specified; otherwise we'll use the Context from the Page.
Definition at line 49 of file Action.php.
array Action::$fields [protected] |
The fields used to create the HTMLForm.
Definition at line 55 of file Action.php.
Page on which we're performing the action.
Definition at line 43 of file Action.php.
Referenced by WatchAction\doUnwatch(), WatchAction\doWatch(), InfoAction\getContributors(), CreditsAction\link(), and EditAction\show().