MediaWiki REL1_30
SpecialPageAction.php
Go to the documentation of this file.
1<?php
32 'revisiondelete' => 'Revisiondelete',
33 'editchangetags' => 'EditTags',
34 ];
35
36 public function getName() {
37 $request = $this->getRequest();
38 $actionName = $request->getVal( 'action', 'view' );
39 // TODO: Shouldn't need to copy-paste this code from Action::getActionName!
40 if ( $actionName === 'historysubmit' ) {
41 if ( $request->getBool( 'revisiondelete' ) ) {
42 $actionName = 'revisiondelete';
43 } elseif ( $request->getBool( 'editchangetags' ) ) {
44 $actionName = 'editchangetags';
45 }
46 }
47
48 if ( isset( self::$actionToSpecialPageMapping[$actionName] ) ) {
49 return $actionName;
50 }
51
52 return 'nosuchaction';
53 }
54
55 public function requiresUnblock() {
56 return false;
57 }
58
59 public function getDescription() {
60 return '';
61 }
62
63 public function onView() {
64 return '';
65 }
66
67 public function show() {
68 $special = $this->getSpecialPage();
69 if ( !$special ) {
70 throw new ErrorPageError(
71 $this->msg( 'nosuchaction' ), $this->msg( 'nosuchactiontext' ) );
72 }
73
74 $special->setContext( $this->getContext() );
75 $special->getContext()->setTitle( $special->getPageTitle() );
76 $special->run( '' );
77 }
78
79 public function doesWrites() {
80 $special = $this->getSpecialPage();
81
82 return $special ? $special->doesWrites() : false;
83 }
84
88 protected function getSpecialPage() {
89 $action = $this->getName();
90 if ( $action === 'nosuchaction' ) {
91 return null;
92 }
93
94 // map actions to (whitelisted) special pages
95 return SpecialPageFactory::getPage( self::$actionToSpecialPageMapping[$action] );
96 }
97}
getContext()
Get the IContextSource in use here.
Definition Action.php:178
msg( $key)
Get a Message object with context set Parameters are the same as wfMessage()
Definition Action.php:256
getRequest()
Get the WebRequest being used for this instance.
Definition Action.php:197
An error page which can definitely be safely rendered using the OutputPage.
An action which just does something, without showing a form first.
An action that just passes the request to the relevant special page.
onView()
Show something on GET request.
show()
The main action entry point.
static array $actionToSpecialPageMapping
A mapping of action names to special page names.
doesWrites()
Indicates whether this action may perform database writes.
getName()
Return the name of the action this object responds to.
getDescription()
Returns the description that goes below the <h1> tag.
requiresUnblock()
Whether this action can still be executed by a blocked user.
static getPage( $name)
Find the object with a given name and return it (or NULL)
do that in ParserLimitReportFormat instead use this to modify the parameters of the image all existing parser cache entries will be invalid To avoid you ll need to handle that somehow(e.g. with the RejectParserCacheValue hook) because MediaWiki won 't do it for you. & $defaults also a ContextSource after deleting those rows but within the same transaction you ll probably need to make sure the header is varied on $request
Definition hooks.txt:2775