BlueSpice MediaWiki master
 All Classes Namespaces Files Functions Variables Groups Pages
Action Class Reference
Inheritance diagram for Action:
Collaboration diagram for Action:

Public Member Functions

 getContext ()
 
 getRequest ()
 
 getOutput ()
 
 getUser ()
 
 getSkin ()
 
 getLanguage ()
 
 getTitle ()
 
 msg ($key)
 
 __construct (Page $page, IContextSource $context=null)
 
 getName ()
 
 getRestriction ()
 
 requiresWrite ()
 
 requiresUnblock ()
 
 addHelpLink ($to, $overrideBaseUrl=false)
 
 show ()
 
 doesWrites ()
 

Static Public Member Functions

static factory ($action, Page $page, IContextSource $context=null)
 
static getActionName (IContextSource $context)
 
static exists ($name)
 

Protected Member Functions

 checkCanExecute (User $user)
 
 setHeaders ()
 
 getPageTitle ()
 
 getDescription ()
 
 useTransactionalTimeLimit ()
 

Protected Attributes

 $page
 
 $context
 
 $fields
 

Detailed Description

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.

Constructor & Destructor Documentation

Action::__construct ( Page  $page,
IContextSource  $context = null 
)

Only public since 1.21

Parameters
Page$page
IContextSource | null$context

Member Function Documentation

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'.

Parameters
string$toTarget MediaWiki.org page title or encoded URL.
bool$overrideBaseUrlWhether $url is a full URL, to avoid MW.o.
Since
1.25
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

Since
1.17
Parameters
User$userThe user to check, or null to use the context user
Exceptions
UserBlockedError|ReadOnlyError|PermissionsError
Action::doesWrites ( )

Indicates whether this action may perform database writes

Returns
bool
Since
1.27
static Action::exists (   $name)
staticfinal

Check if a given action is recognised, even if it's disabled

Since
1.17
Parameters
string$nameName of an action
Returns
bool
static Action::factory (   $action,
Page  $page,
IContextSource  $context = null 
)
staticfinal

Get an appropriate Action subclass for the given action

Since
1.17
Parameters
string$action
Page$page
IContextSource | null$context
Returns
Action|bool|null False if the action is disabled, null if it is not recognised
static Action::getActionName ( IContextSource  $context)
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".

Since
1.19
Parameters
IContextSource$context
Returns
string Action name
Action::getContext ( )
final

Get the IContextSource in use here

Since
1.17
Returns
IContextSource
Action::getDescription ( )
protected

Returns the description that goes below the <h1> tag

Since
1.17
Returns
string HTML
Action::getLanguage ( )
final

Shortcut to get the user Language being used for this instance

Returns
Language
Action::getName ( )
abstract

Return the name of the action this object responds to

Since
1.17
Returns
string Lowercase name
Action::getOutput ( )
final

Get the OutputPage being used for this instance

Since
1.17
Returns
OutputPage
Action::getPageTitle ( )
protected

Returns the name that goes in the <h1> page title

Returns
string
Action::getRequest ( )
final

Get the WebRequest being used for this instance

Since
1.17
Returns
WebRequest
Action::getRestriction ( )

Get the permission required to perform this action. Often, but not always, the same as the action name

Since
1.17
Returns
string|null
Action::getSkin ( )
final

Shortcut to get the Skin being used for this instance

Since
1.17
Returns
Skin
Action::getTitle ( )
final

Shortcut to get the Title object from the page

Since
1.17
Returns
Title
Action::getUser ( )
final

Shortcut to get the User being used for this instance

Since
1.17
Returns
User
Action::msg (   $key)
final

Get a Message object with context set Parameters are the same as wfMessage()

Returns
Message

Implements MessageLocalizer.

Action::requiresUnblock ( )

Whether this action can still be executed by a blocked user

Since
1.17
Returns
bool
Action::requiresWrite ( )

Whether this action requires the wiki not to be locked

Since
1.17
Returns
bool
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.

Since
1.17
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.

Since
1.17
Exceptions
ErrorPageError
Action::useTransactionalTimeLimit ( )
protected

Call wfTransactionalTimeLimit() if this request was POSTed

Since
1.26

Member Data Documentation

IContextSource Action::$context
protected

IContextSource if specified; otherwise we'll use the Context from the Page

Since
1.17
array Action::$fields
protected

The fields used to create the HTMLForm

Since
1.17
WikiPage Article ImagePage CategoryPage Page Action::$page
protected

Page on which we're performing the action

Since
1.17

The documentation for this class was generated from the following file: