/**
* Page on which we're performing the action
+ * @since 1.17
* @var WikiPage|Article|ImagePage|CategoryPage|Page $page
*/
protected $page;
/**
* IContextSource if specified; otherwise we'll use the Context from the Page
+ * @since 1.17
* @var IContextSource $context
*/
protected $context;
/**
* The fields used to create the HTMLForm
- * @var Array $fields
+ * @since 1.17
+ * @var array $fields
*/
protected $fields;
/**
* 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
- * @param $action String
- * @param $overrides Array
+ * @param string $action
+ * @param array $overrides
* @return bool|null|string|callable
*/
final private static function getClass( $action, array $overrides ) {
/**
* Get an appropriate Action subclass for the given action
- * @param $action String
- * @param $page Page
- * @param $context IContextSource
- * @return Action|bool|null false if the action is disabled, null
+ * @since 1.17
+ * @param string $action
+ * @param Page $page
+ * @param IContextSource $context
+ * @return Action|bool|null False if the action is disabled, null
* if it is not recognised
*/
final public static function factory( $action, Page $page, IContextSource $context = null ) {
* $wgActions will be replaced by "nosuchaction".
*
* @since 1.19
- * @param $context IContextSource
- * @return string: action name
+ * @param IContextSource $context
+ * @return string Action name
*/
final public static function getActionName( IContextSource $context ) {
global $wgActions;
/**
* Check if a given action is recognised, even if it's disabled
+ * @since 1.17
*
- * @param string $name name of an action
- * @return Bool
+ * @param string $name Name of an action
+ * @return bool
*/
final public static function exists( $name ) {
return self::getClass( $name, array() ) !== null;
/**
* Get the IContextSource in use here
+ * @since 1.17
* @return IContextSource
*/
final public function getContext() {
/**
* Get the WebRequest being used for this instance
+ * @since 1.17
*
* @return WebRequest
*/
/**
* Get the OutputPage being used for this instance
+ * @since 1.17
*
* @return OutputPage
*/
/**
* Shortcut to get the User being used for this instance
+ * @since 1.17
*
* @return User
*/
/**
* Shortcut to get the Skin being used for this instance
+ * @since 1.17
*
* @return Skin
*/
return $this->getContext()->getLanguage();
}
- /**
- * Shortcut to get the user Language being used for this instance
- *
- * @deprecated since 1.19 Use getLanguage instead
- * @return Language
- */
- final public function getLang() {
- wfDeprecated( __METHOD__, '1.19' );
- return $this->getLanguage();
- }
-
/**
* Shortcut to get the Title object from the page
+ * @since 1.17
+ *
* @return Title
*/
final public function getTitle() {
* Get a Message object with context set
* Parameters are the same as wfMessage()
*
- * @return Message object
+ * @return Message
*/
final public function msg() {
$params = func_get_args();
*
* Only public since 1.21
*
- * @param $page Page
- * @param $context IContextSource
+ * @param Page $page
+ * @param IContextSource $context
*/
public function __construct( Page $page, IContextSource $context = null ) {
if ( $context === null ) {
/**
* Return the name of the action this object responds to
- * @return String lowercase
+ * @since 1.17
+ *
+ * @return string Lowercase name
*/
abstract public function getName();
/**
* Get the permission required to perform this action. Often, but not always,
* the same as the action name
- * @return String|null
+ * @since 1.17
+ *
+ * @return string|null
*/
public function getRestriction() {
return null;
* 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
*
- * @param $user User: the user to check, or null to use the context user
+ * @param User $user The user to check, or null to use the context user
* @throws UserBlockedError|ReadOnlyError|PermissionsError
- * @return bool True on success
*/
protected function checkCanExecute( User $user ) {
$right = $this->getRestriction();
if ( $this->requiresWrite() && wfReadOnly() ) {
throw new ReadOnlyError();
}
- return true;
}
/**
* Whether this action requires the wiki not to be locked
- * @return Bool
+ * @since 1.17
+ *
+ * @return bool
*/
public function requiresWrite() {
return true;
/**
* Whether this action can still be executed by a blocked user
- * @return Bool
+ * @since 1.17
+ *
+ * @return bool
*/
public function requiresUnblock() {
return true;
/**
* 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
*/
protected function setHeaders() {
$out = $this->getOutput();
/**
* Returns the name that goes in the \<h1\> page title
*
- * @return String
+ * @return string
*/
protected function getPageTitle() {
return $this->getTitle()->getPrefixedText();
/**
* Returns the description that goes below the \<h1\> tag
+ * @since 1.17
*
- * @return String
+ * @return string
*/
protected function getDescription() {
return $this->msg( strtolower( $this->getName() ) )->escaped();
* 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
+ *
* @throws ErrorPageError
*/
abstract public function show();
-
- /**
- * Execute the action in a silent fashion: do not display anything or release any errors.
- * @return Bool whether execution was successful
- */
- abstract public function execute();
}