MediaWiki fundraising/REL1_35
Action.php
Go to the documentation of this file.
1<?php
25
43abstract class Action implements MessageLocalizer {
44
53 protected $page;
54
59 private $article;
60
66 protected $context;
67
73 protected $fields;
74
82 private static function getClass(
83 string $action,
84 array $overrides
85 ) {
86 global $wgActions;
87 $action = strtolower( $action );
88
89 if ( !isset( $wgActions[$action] ) ) {
90 return null;
91 }
92
93 if ( $wgActions[$action] === false ) {
94 return false;
95 } elseif ( $wgActions[$action] === true && isset( $overrides[$action] ) ) {
96 return $overrides[$action];
97 } elseif ( $wgActions[$action] === true ) {
98 return ucfirst( $action ) . 'Action';
99 } else {
100 return $wgActions[$action];
101 }
102 }
103
115 final public static function factory(
116 ?string $action,
117 Page $article,
118 IContextSource $context = null
119 ) {
120 if ( !is_string( $action ) ) {
121 wfDeprecated( __METHOD__ . ' with null $action', '1.35' );
122 return null;
123 }
124 if ( !$article instanceof Article ) {
126 __METHOD__ . ' with ' . get_class( $article ),
127 '1.35'
128 );
129 }
130 $classOrCallable = self::getClass( $action, $article->getActionOverrides() );
131 if ( is_string( $classOrCallable ) ) {
132 if ( !class_exists( $classOrCallable ) ) {
133 return false;
134 }
135 return new $classOrCallable( $article, $context );
136 }
137
138 if ( is_callable( $classOrCallable ) ) {
139 return $classOrCallable( $article, $context );
140 }
141
142 return $classOrCallable;
143 }
144
154 final public static function getActionName( IContextSource $context ) {
155 global $wgActions;
156
157 $request = $context->getRequest();
158 $actionName = $request->getVal( 'action', 'view' );
159
160 // Check for disabled actions
161 if ( isset( $wgActions[$actionName] ) && $wgActions[$actionName] === false ) {
162 $actionName = 'nosuchaction';
163 }
164
165 // Workaround for T22966: inability of IE to provide an action dependent
166 // on which submit button is clicked.
167 if ( $actionName === 'historysubmit' ) {
168 if ( $request->getBool( 'revisiondelete' ) ) {
169 $actionName = 'revisiondelete';
170 } elseif ( $request->getBool( 'editchangetags' ) ) {
171 $actionName = 'editchangetags';
172 } else {
173 $actionName = 'view';
174 }
175 } elseif ( $actionName === 'editredlink' ) {
176 $actionName = 'edit';
177 }
178
179 // Trying to get a WikiPage for NS_SPECIAL etc. will result
180 // in WikiPage::factory throwing "Invalid or virtual namespace -1 given."
181 // For SpecialPages et al, default to action=view.
182 if ( !$context->canUseWikiPage() ) {
183 return 'view';
184 }
185
186 $action = self::factory(
187 $actionName,
188 Article::newFromWikiPage( $context->getWikiPage(), $context ),
189 $context
190 );
191
192 if ( $action instanceof Action ) {
193 return $action->getName();
194 }
195
196 return 'nosuchaction';
197 }
198
206 final public static function exists( string $name ) : bool {
207 return self::getClass( $name, [] ) !== null;
208 }
209
215 final public function getContext() {
216 if ( $this->context instanceof IContextSource ) {
217 return $this->context;
218 }
219 wfDebug( __METHOD__ . ": no context known, falling back to Article's context." );
220 return $this->getArticle()->getContext();
221 }
222
229 final public function getRequest() {
230 return $this->getContext()->getRequest();
231 }
232
239 final public function getOutput() {
240 return $this->getContext()->getOutput();
241 }
242
249 final public function getUser() {
250 return $this->getContext()->getUser();
251 }
252
259 final public function getSkin() {
260 return $this->getContext()->getSkin();
261 }
262
268 final public function getLanguage() {
269 return $this->getContext()->getLanguage();
270 }
271
278 final public function getWikiPage() : WikiPage {
279 return $this->getArticle()->getPage();
280 }
281
289 public function getArticle() {
290 return $this->article;
291 }
292
299 final public function getTitle() {
300 return $this->getWikiPage()->getTitle();
301 }
302
311 final public function msg( $key, ...$params ) {
312 return $this->getContext()->msg( $key, ...$params );
313 }
314
319 protected function getHookContainer() {
320 return MediaWikiServices::getInstance()->getHookContainer();
321 }
322
329 protected function getHookRunner() {
330 return new HookRunner( $this->getHookContainer() );
331 }
332
342 public function __construct(
343 Page $page,
344 IContextSource $context = null
345 ) {
346 if ( $context === null ) {
347 wfWarn( __METHOD__ . ' called without providing a Context object.' );
348 }
349
350 $this->page = $page;// @todo remove b/c
351 $this->article = self::convertPageToArticle( $page, $context, __METHOD__ );
352 $this->context = $context;
353 }
354
355 private static function convertPageToArticle(
356 Page $page,
357 ?IContextSource $context,
358 string $method
359 ) : Article {
360 if ( $page instanceof Article ) {
361 return $page;
362 }
363
364 if ( !$page instanceof WikiPage ) {
365 throw new LogicException(
366 $method . ' called with unknown Page: ' . get_class( $page )
367 );
368 }
369
371 $method . ' with: ' . get_class( $page ),
372 '1.35'
373 );
374
376 $page,
377 $context ?? RequestContext::getMain()
378 );
379 }
380
387 abstract public function getName();
388
397 public function getRestriction() {
398 return null;
399 }
400
407 public function needsReadRights() {
408 return true;
409 }
410
421 protected function checkCanExecute( User $user ) {
422 $right = $this->getRestriction();
423 if ( $right !== null ) {
424 $errors = MediaWikiServices::getInstance()->getPermissionManager()
425 ->getPermissionErrors( $right, $user, $this->getTitle() );
426 if ( count( $errors ) ) {
427 throw new PermissionsError( $right, $errors );
428 }
429 }
430
431 // If the action requires an unblock, explicitly check the user's block.
432 if ( $this->requiresUnblock() && $user->isBlockedFrom( $this->getTitle() ) ) {
433 $block = $user->getBlock();
434 if ( $block ) {
435 throw new UserBlockedError(
436 $block,
437 $user,
438 $this->getLanguage(),
439 $this->getRequest()->getIP()
440 );
441 }
442
443 throw new PermissionsError( $this->getName(), [ 'badaccess-group0' ] );
444 }
445
446 // This should be checked at the end so that the user won't think the
447 // error is only temporary when he also don't have the rights to execute
448 // this action
449 if ( $this->requiresWrite() && wfReadOnly() ) {
450 throw new ReadOnlyError();
451 }
452 }
453
461 public function requiresWrite() {
462 return true;
463 }
464
472 public function requiresUnblock() {
473 return true;
474 }
475
482 protected function setHeaders() {
483 $out = $this->getOutput();
484 $out->setRobotPolicy( 'noindex,nofollow' );
485 $out->setPageTitle( $this->getPageTitle() );
486 $out->setSubtitle( $this->getDescription() );
487 $out->setArticleRelated( true );
488 }
489
496 protected function getPageTitle() {
497 return $this->getTitle()->getPrefixedText();
498 }
499
507 protected function getDescription() {
508 return $this->msg( strtolower( $this->getName() ) )->escaped();
509 }
510
519 public function addHelpLink( $to, $overrideBaseUrl = false ) {
520 $msg = wfMessage( MediaWikiServices::getInstance()->getContentLanguage()->lc(
521 self::getActionName( $this->getContext() )
522 ) . '-helppage' );
523
524 if ( !$msg->isDisabled() ) {
525 $helpUrl = Skin::makeUrl( $msg->plain() );
526 $this->getOutput()->addHelpLink( $helpUrl, true );
527 } else {
528 $this->getOutput()->addHelpLink( $to, $overrideBaseUrl );
529 }
530 }
531
540 abstract public function show();
541
546 protected function useTransactionalTimeLimit() {
547 if ( $this->getRequest()->wasPosted() ) {
549 }
550 }
551
558 public function doesWrites() {
559 return false;
560 }
561}
$wgActions
Array of allowed values for the "title=foo&action=<action>" parameter.
wfDebug( $text, $dest='all', array $context=[])
Sends a line to the debug log if enabled or, optionally, to a comment in output.
wfWarn( $msg, $callerOffset=1, $level=E_USER_NOTICE)
Send a warning either to the debug log or in a PHP error depending on $wgDevelopmentWarnings.
wfReadOnly()
Check whether the wiki is in read-only mode.
wfTransactionalTimeLimit()
Set PHP's time limit to the larger of php.ini or $wgTransactionalTimeLimit.
wfMessage( $key,... $params)
This is the function for getting translated interface messages.
wfDeprecated( $function, $version=false, $component=false, $callerOffset=2)
Logs a warning that $function is deprecated.
getContext()
return[ 'abap'=> true, 'abl'=> true, 'abnf'=> true, 'aconf'=> true, 'actionscript'=> true, 'actionscript3'=> true, 'ada'=> true, 'ada2005'=> true, 'ada95'=> true, 'adl'=> true, 'agda'=> true, 'aheui'=> true, 'ahk'=> true, 'alloy'=> true, 'ambienttalk'=> true, 'ambienttalk/2'=> true, 'ampl'=> true, 'antlr'=> true, 'antlr-actionscript'=> true, 'antlr-as'=> true, 'antlr-c#'=> true, 'antlr-cpp'=> true, 'antlr-csharp'=> true, 'antlr-java'=> true, 'antlr-objc'=> true, 'antlr-perl'=> true, 'antlr-python'=> true, 'antlr-rb'=> true, 'antlr-ruby'=> true, 'apache'=> true, 'apacheconf'=> true, 'apl'=> true, 'applescript'=> true, 'arduino'=> true, 'arexx'=> true, 'arrow'=> true, 'as'=> true, 'as3'=> true, 'asm'=> true, 'aspectj'=> true, 'aspx-cs'=> true, 'aspx-vb'=> true, 'asy'=> true, 'asymptote'=> true, 'at'=> true, 'augeas'=> true, 'autohotkey'=> true, 'autoit'=> true, 'awk'=> true, 'b3d'=> true, 'bare'=> true, 'basemake'=> true, 'bash'=> true, 'basic'=> true, 'bat'=> true, 'batch'=> true, 'bbcbasic'=> true, 'bbcode'=> true, 'bc'=> true, 'befunge'=> true, 'bf'=> true, 'bib'=> true, 'bibtex'=> true, 'blitzbasic'=> true, 'blitzmax'=> true, 'bmax'=> true, 'bnf'=> true, 'boa'=> true, 'boo'=> true, 'boogie'=> true, 'bplus'=> true, 'brainfuck'=> true, 'bro'=> true, 'bsdmake'=> true, 'bst'=> true, 'bst-pybtex'=> true, 'bugs'=> true, 'c'=> true, 'c#'=> true, 'c++'=> true, 'c++-objdumb'=> true, 'c-objdump'=> true, 'ca65'=> true, 'cadl'=> true, 'camkes'=> true, 'capdl'=> true, 'capnp'=> true, 'cbmbas'=> true, 'ceylon'=> true, 'cf3'=> true, 'cfc'=> true, 'cfengine3'=> true, 'cfg'=> true, 'cfm'=> true, 'cfs'=> true, 'chai'=> true, 'chaiscript'=> true, 'chapel'=> true, 'charmci'=> true, 'cheetah'=> true, 'chpl'=> true, 'cirru'=> true, 'cl'=> true, 'clay'=> true, 'clean'=> true, 'clipper'=> true, 'clj'=> true, 'cljs'=> true, 'clojure'=> true, 'clojurescript'=> true, 'cmake'=> true, 'cobol'=> true, 'cobolfree'=> true, 'coffee'=> true, 'coffee-script'=> true, 'coffeescript'=> true, 'common-lisp'=> true, 'componentpascal'=> true, 'console'=> true, 'control'=> true, 'coq'=> true, 'cp'=> true, 'cpp'=> true, 'cpp-objdump'=> true, 'cpsa'=> true, 'cr'=> true, 'crmsh'=> true, 'croc'=> true, 'cry'=> true, 'cryptol'=> true, 'crystal'=> true, 'csh'=> true, 'csharp'=> true, 'csound'=> true, 'csound-csd'=> true, 'csound-document'=> true, 'csound-orc'=> true, 'csound-sco'=> true, 'csound-score'=> true, 'css'=> true, 'css+django'=> true, 'css+erb'=> true, 'css+genshi'=> true, 'css+genshitext'=> true, 'css+jinja'=> true, 'css+lasso'=> true, 'css+mako'=> true, 'css+mozpreproc'=> true, 'css+myghty'=> true, 'css+php'=> true, 'css+ruby'=> true, 'css+smarty'=> true, 'cu'=> true, 'cucumber'=> true, 'cuda'=> true, 'cxx-objdump'=> true, 'cypher'=> true, 'cython'=> true, 'd'=> true, 'd-objdump'=> true, 'dart'=> true, 'dasm16'=> true, 'debcontrol'=> true, 'debsources'=> true, 'delphi'=> true, 'devicetree'=> true, 'dg'=> true, 'diff'=> true, 'django'=> true, 'dmesg'=> true, 'do'=> true, 'docker'=> true, 'dockerfile'=> true, 'dosbatch'=> true, 'doscon'=> true, 'dosini'=> true, 'dpatch'=> true, 'dtd'=> true, 'dts'=> true, 'duby'=> true, 'duel'=> true, 'dylan'=> true, 'dylan-console'=> true, 'dylan-lid'=> true, 'dylan-repl'=> true, 'earl-grey'=> true, 'earlgrey'=> true, 'easytrieve'=> true, 'ebnf'=> true, 'ec'=> true, 'ecl'=> true, 'eg'=> true, 'eiffel'=> true, 'elisp'=> true, 'elixir'=> true, 'elm'=> true, 'emacs'=> true, 'emacs-lisp'=> true, 'email'=> true, 'eml'=> true, 'erb'=> true, 'erl'=> true, 'erlang'=> true, 'evoque'=> true, 'ex'=> true, 'execline'=> true, 'exs'=> true, 'extempore'=> true, 'ezhil'=> true, 'f#'=> true, 'factor'=> true, 'fan'=> true, 'fancy'=> true, 'felix'=> true, 'fennel'=> true, 'fish'=> true, 'fishshell'=> true, 'flatline'=> true, 'flo'=> true, 'floscript'=> true, 'flx'=> true, 'fnl'=> true, 'forth'=> true, 'fortran'=> true, 'fortranfixed'=> true, 'foxpro'=> true, 'freefem'=> true, 'fsharp'=> true, 'fstar'=> true, 'fy'=> true, 'gap'=> true, 'gas'=> true, 'gawk'=> true, 'gd'=> true, 'gdscript'=> true, 'genshi'=> true, 'genshitext'=> true, 'gherkin'=> true, 'glsl'=> true, 'gnuplot'=> true, 'go'=> true, 'golo'=> true, 'gooddata-cl'=> true, 'gosu'=> true, 'groff'=> true, 'groovy'=> true, 'gst'=> true, 'haml'=> true, 'handlebars'=> true, 'haskell'=> true, 'haxe'=> true, 'haxeml'=> true, 'hexdump'=> true, 'hlsl'=> true, 'hs'=> true, 'hsa'=> true, 'hsail'=> true, 'hspec'=> true, 'html'=> true, 'html+cheetah'=> true, 'html+django'=> true, 'html+erb'=> true, 'html+evoque'=> true, 'html+genshi'=> true, 'html+handlebars'=> true, 'html+jinja'=> true, 'html+kid'=> true, 'html+lasso'=> true, 'html+mako'=> true, 'html+myghty'=> true, 'html+ng2'=> true, 'html+php'=> true, 'html+ruby'=> true, 'html+smarty'=> true, 'html+spitfire'=> true, 'html+twig'=> true, 'html+velocity'=> true, 'htmlcheetah'=> true, 'htmldjango'=> true, 'http'=> true, 'hx'=> true, 'hxml'=> true, 'hxsl'=> true, 'hy'=> true, 'hybris'=> true, 'hylang'=> true, 'i6'=> true, 'i6t'=> true, 'i7'=> true, 'icon'=> true, 'idl'=> true, 'idl4'=> true, 'idr'=> true, 'idris'=> true, 'iex'=> true, 'igor'=> true, 'igorpro'=> true, 'ik'=> true, 'inform6'=> true, 'inform7'=> true, 'ini'=> true, 'io'=> true, 'ioke'=> true, 'irb'=> true, 'irc'=> true, 'isabelle'=> true, 'j'=> true, 'jade'=> true, 'jags'=> true, 'jasmin'=> true, 'jasminxt'=> true, 'java'=> true, 'javascript'=> true, 'javascript+cheetah'=> true, 'javascript+django'=> true, 'javascript+erb'=> true, 'javascript+genshi'=> true, 'javascript+genshitext'=> true, 'javascript+jinja'=> true, 'javascript+lasso'=> true, 'javascript+mako'=> true, 'javascript+mozpreproc'=> true, 'javascript+myghty'=> true, 'javascript+php'=> true, 'javascript+ruby'=> true, 'javascript+smarty'=> true, 'javascript+spitfire'=> true, 'jbst'=> true, 'jcl'=> true, 'jinja'=> true, 'jl'=> true, 'jlcon'=> true, 'jproperties'=> true, 'js'=> true, 'js+cheetah'=> true, 'js+django'=> true, 'js+erb'=> true, 'js+genshi'=> true, 'js+genshitext'=> true, 'js+jinja'=> true, 'js+lasso'=> true, 'js+mako'=> true, 'js+myghty'=> true, 'js+php'=> true, 'js+ruby'=> true, 'js+smarty'=> true, 'js+spitfire'=> true, 'jsgf'=> true, 'json'=> true, 'json-ld'=> true, 'json-object'=> true, 'jsonld'=> true, 'jsonml+bst'=> true, 'jsp'=> true, 'julia'=> true, 'juttle'=> true, 'kal'=> true, 'kconfig'=> true, 'kernel-config'=> true, 'kid'=> true, 'kmsg'=> true, 'koka'=> true, 'kotlin'=> true, 'ksh'=> true, 'lagda'=> true, 'lasso'=> true, 'lassoscript'=> true, 'latex'=> true, 'lcry'=> true, 'lcryptol'=> true, 'lean'=> true, 'less'=> true, 'lhaskell'=> true, 'lhs'=> true, 'lid'=> true, 'lidr'=> true, 'lidris'=> true, 'lighttpd'=> true, 'lighty'=> true, 'limbo'=> true, 'linux-config'=> true, 'liquid'=> true, 'lisp'=> true, 'literate-agda'=> true, 'literate-cryptol'=> true, 'literate-haskell'=> true, 'literate-idris'=> true, 'live-script'=> true, 'livescript'=> true, 'llvm'=> true, 'llvm-mir'=> true, 'llvm-mir-body'=> true, 'logos'=> true, 'logtalk'=> true, 'lsl'=> true, 'lua'=> true, 'm2'=> true, 'make'=> true, 'makefile'=> true, 'mako'=> true, 'man'=> true, 'maql'=> true, 'mask'=> true, 'mason'=> true, 'mathematica'=> true, 'matlab'=> true, 'matlabsession'=> true, 'mawk'=> true, 'md'=> true, 'menuconfig'=> true, 'mf'=> true, 'mime'=> true, 'minid'=> true, 'miniscript'=> true, 'mma'=> true, 'modelica'=> true, 'modula2'=> true, 'moin'=> true, 'monkey'=> true, 'monte'=> true, 'moo'=> true, 'moocode'=> true, 'moon'=> true, 'moonscript'=> true, 'mosel'=> true, 'mozhashpreproc'=> true, 'mozpercentpreproc'=> true, 'mq4'=> true, 'mq5'=> true, 'mql'=> true, 'mql4'=> true, 'mql5'=> true, 'ms'=> true, 'msc'=> true, 'mscgen'=> true, 'mupad'=> true, 'mxml'=> true, 'myghty'=> true, 'mysql'=> true, 'nasm'=> true, 'nawk'=> true, 'nb'=> true, 'ncl'=> true, 'nemerle'=> true, 'nesc'=> true, 'newlisp'=> true, 'newspeak'=> true, 'ng2'=> true, 'nginx'=> true, 'nim'=> true, 'nimrod'=> true, 'nit'=> true, 'nix'=> true, 'nixos'=> true, 'notmuch'=> true, 'nroff'=> true, 'nsh'=> true, 'nsi'=> true, 'nsis'=> true, 'numpy'=> true, 'nusmv'=> true, 'obj-c'=> true, 'obj-c++'=> true, 'obj-j'=> true, 'objc'=> true, 'objc++'=> true, 'objdump'=> true, 'objdump-nasm'=> true, 'objective-c'=> true, 'objective-c++'=> true, 'objective-j'=> true, 'objectivec'=> true, 'objectivec++'=> true, 'objectivej'=> true, 'objectpascal'=> true, 'objj'=> true, 'ocaml'=> true, 'octave'=> true, 'odin'=> true, 'ooc'=> true, 'opa'=> true, 'openbugs'=> true, 'openedge'=> true, 'pacmanconf'=> true, 'pan'=> true, 'parasail'=> true, 'pas'=> true, 'pascal'=> true, 'pawn'=> true, 'pcmk'=> true, 'peg'=> true, 'perl'=> true, 'perl6'=> true, 'php'=> true, 'php3'=> true, 'php4'=> true, 'php5'=> true, 'pig'=> true, 'pike'=> true, 'pkgconfig'=> true, 'pl'=> true, 'pl6'=> true, 'plpgsql'=> true, 'po'=> true, 'pointless'=> true, 'pony'=> true, 'posh'=> true, 'postgres'=> true, 'postgres-console'=> true, 'postgresql'=> true, 'postgresql-console'=> true, 'postscr'=> true, 'postscript'=> true, 'pot'=> true, 'pov'=> true, 'powershell'=> true, 'praat'=> true, 'progress'=> true, 'prolog'=> true, 'promql'=> true, 'properties'=> true, 'proto'=> true, 'protobuf'=> true, 'ps1'=> true, 'ps1con'=> true, 'psm1'=> true, 'psql'=> true, 'psysh'=> true, 'pug'=> true, 'puppet'=> true, 'py'=> true, 'py2'=> true, 'py2tb'=> true, 'py3'=> true, 'py3tb'=> true, 'pycon'=> true, 'pypy'=> true, 'pypylog'=> true, 'pyrex'=> true, 'pytb'=> true, 'python'=> true, 'python2'=> true, 'python3'=> true, 'pyx'=> true, 'qbasic'=> true, 'qbs'=> true, 'qml'=> true, 'qvt'=> true, 'qvto'=> true, 'r'=> true, 'racket'=> true, 'ragel'=> true, 'ragel-c'=> true, 'ragel-cpp'=> true, 'ragel-d'=> true, 'ragel-em'=> true, 'ragel-java'=> true, 'ragel-objc'=> true, 'ragel-rb'=> true, 'ragel-ruby'=> true, 'raku'=> true, 'raw'=> true, 'rb'=> true, 'rbcon'=> true, 'rconsole'=> true, 'rd'=> true, 'reason'=> true, 'reasonml'=> true, 'rebol'=> true, 'red'=> true, 'red/system'=> true, 'redcode'=> true, 'registry'=> true, 'resource'=> true, 'resourcebundle'=> true, 'rest'=> true, 'restructuredtext'=> true, 'rexx'=> true, 'rhtml'=> true, 'ride'=> true, 'rkt'=> true, 'rnc'=> true, 'rng-compact'=> true, 'roboconf-graph'=> true, 'roboconf-instances'=> true, 'robotframework'=> true, 'rout'=> true, 'rql'=> true, 'rs'=> true, 'rsl'=> true, 'rst'=> true, 'rts'=> true, 'ruby'=> true, 'rust'=> true, 's'=> true, 'sage'=> true, 'salt'=> true, 'sarl'=> true, 'sas'=> true, 'sass'=> true, 'sbatch'=> true, 'sc'=> true, 'scala'=> true, 'scaml'=> true, 'scd'=> true, 'scdoc'=> true, 'scheme'=> true, 'scilab'=> true, 'scm'=> true, 'scss'=> true, 'sgf'=> true, 'sh'=> true, 'shell'=> true, 'shell-session'=> true, 'shen'=> true, 'shex'=> true, 'shexc'=> true, 'sieve'=> true, 'silver'=> true, 'singularity'=> true, 'slash'=> true, 'slim'=> true, 'sls'=> true, 'slurm'=> true, 'smali'=> true, 'smalltalk'=> true, 'smarty'=> true, 'sml'=> true, 'snobol'=> true, 'snowball'=> true, 'solidity'=> true, 'sources.list'=> true, 'sourceslist'=> true, 'sp'=> true, 'sparql'=> true, 'spec'=> true, 'spitfire'=> true, 'splus'=> true, 'sql'=> true, 'sqlite3'=> true, 'squeak'=> true, 'squid'=> true, 'squid.conf'=> true, 'squidconf'=> true, 'ssp'=> true, 'st'=> true, 'stan'=> true, 'stata'=> true, 'supercollider'=> true, 'sv'=> true, 'swift'=> true, 'swig'=> true, 'systemverilog'=> true, 't-sql'=> true, 'tads3'=> true, 'tap'=> true, 'tasm'=> true, 'tcl'=> true, 'tcsh'=> true, 'tcshcon'=> true, 'tea'=> true, 'teraterm'=> true, 'teratermmacro'=> true, 'termcap'=> true, 'terminfo'=> true, 'terraform'=> true, 'tex'=> true, 'text'=> true, 'tf'=> true, 'thrift'=> true, 'tid'=> true, 'tnt'=> true, 'todotxt'=> true, 'toml'=> true, 'trac-wiki'=> true, 'trafficscript'=> true, 'treetop'=> true, 'ts'=> true, 'tsql'=> true, 'ttl'=> true, 'turtle'=> true, 'twig'=> true, 'typescript'=> true, 'typoscript'=> true, 'typoscriptcssdata'=> true, 'typoscripthtmldata'=> true, 'ucode'=> true, 'udiff'=> true, 'unicon'=> true, 'urbiscript'=> true, 'usd'=> true, 'usda'=> true, 'v'=> true, 'vala'=> true, 'vapi'=> true, 'vb.net'=> true, 'vbnet'=> true, 'vbscript'=> true, 'vcl'=> true, 'vclsnippet'=> true, 'vclsnippets'=> true, 'vctreestatus'=> true, 'velocity'=> true, 'verilog'=> true, 'vfp'=> true, 'vgl'=> true, 'vhdl'=> true, 'vim'=> true, 'wdiff'=> true, 'webidl'=> true, 'whiley'=> true, 'winbatch'=> true, 'winbugs'=> true, 'x10'=> true, 'xbase'=> true, 'xml'=> true, 'xml+cheetah'=> true, 'xml+django'=> true, 'xml+erb'=> true, 'xml+evoque'=> true, 'xml+genshi'=> true, 'xml+jinja'=> true, 'xml+kid'=> true, 'xml+lasso'=> true, 'xml+mako'=> true, 'xml+myghty'=> true, 'xml+php'=> true, 'xml+ruby'=> true, 'xml+smarty'=> true, 'xml+spitfire'=> true, 'xml+velocity'=> true, 'xorg.conf'=> true, 'xq'=> true, 'xql'=> true, 'xqm'=> true, 'xquery'=> true, 'xqy'=> true, 'xslt'=> true, 'xten'=> true, 'xtend'=> true, 'xul+mozpreproc'=> true, 'yaml'=> true, 'yaml+jinja'=> true, 'yang'=> true, 'zeek'=> true, 'zephir'=> true, 'zig'=> true, 'zsh'=> true,]
Actions are things which can be done to pages (edit, delete, rollback, etc).
Definition Action.php:43
getHookContainer()
Definition Action.php:319
getWikiPage()
Get a WikiPage object.
Definition Action.php:278
static factory(?string $action, Page $article, IContextSource $context=null)
Get an appropriate Action subclass for the given action.
Definition Action.php:115
doesWrites()
Indicates whether this action may perform database writes.
Definition Action.php:558
static getClass(string $action, array $overrides)
Get the Action subclass which should be used to handle this action, false if the action is disabled,...
Definition Action.php:82
checkCanExecute(User $user)
Checks if the given user (identified by an object) can perform this action.
Definition Action.php:421
getHookRunner()
Definition Action.php:329
getName()
Return the name of the action this object responds to.
WikiPage Article ImagePage CategoryPage Page $page
Page on which we're performing the action.
Definition Action.php:53
addHelpLink( $to, $overrideBaseUrl=false)
Adds help link with an icon via page indicators.
Definition Action.php:519
needsReadRights()
Indicates whether this action requires read rights.
Definition Action.php:407
requiresWrite()
Whether this action requires the wiki not to be locked.
Definition Action.php:461
getDescription()
Returns the description that goes below the <h1> tag.
Definition Action.php:507
getPageTitle()
Returns the name that goes in the <h1> page title.
Definition Action.php:496
Article $article
Definition Action.php:59
getTitle()
Shortcut to get the Title object from the page.
Definition Action.php:299
static convertPageToArticle(Page $page, ?IContextSource $context, string $method)
Definition Action.php:355
getContext()
Get the IContextSource in use here.
Definition Action.php:215
requiresUnblock()
Whether this action can still be executed by a blocked user.
Definition Action.php:472
getOutput()
Get the OutputPage being used for this instance.
Definition Action.php:239
getUser()
Shortcut to get the User being used for this instance.
Definition Action.php:249
static exists(string $name)
Check if a given action is recognised, even if it's disabled.
Definition Action.php:206
IContextSource $context
IContextSource if specified; otherwise we'll use the Context from the Page.
Definition Action.php:66
setHeaders()
Set output headers for noindexing etc.
Definition Action.php:482
getRestriction()
Get the permission required to perform this action.
Definition Action.php:397
getSkin()
Shortcut to get the Skin being used for this instance.
Definition Action.php:259
getArticle()
Get a Article object.
Definition Action.php:289
show()
The main action entry point.
useTransactionalTimeLimit()
Call wfTransactionalTimeLimit() if this request was POSTed.
Definition Action.php:546
static getActionName(IContextSource $context)
Get the action that will be executed, not necessarily the one passed passed through the "action" requ...
Definition Action.php:154
msg( $key,... $params)
Get a Message object with context set Parameters are the same as wfMessage()
Definition Action.php:311
array $fields
The fields used to create the HTMLForm.
Definition Action.php:73
getLanguage()
Shortcut to get the user Language being used for this instance.
Definition Action.php:268
__construct(Page $page, IContextSource $context=null)
Only public since 1.21.
Definition Action.php:342
getRequest()
Get the WebRequest being used for this instance.
Definition Action.php:229
Class for viewing MediaWiki article and history.
Definition Article.php:46
static newFromWikiPage(WikiPage $page, IContextSource $context)
Create an Article object of the appropriate class for the given page.
Definition Article.php:226
Special handling for category description pages, showing pages, subcategories and file that belong to...
Class for viewing MediaWiki file description pages.
Definition ImagePage.php:33
This class provides an implementation of the core hook interfaces, forwarding hook calls to HookConta...
MediaWikiServices is the service locator for the application scope of MediaWiki.
Show an error when a user tries to do something they do not have the necessary permissions for.
Show an error when the wiki is locked/read-only and the user tries to do something that requires writ...
Show an error when the user tries to do something whilst blocked.
The User object encapsulates all of the user-specific settings (user_id, name, rights,...
Definition User.php:60
getBlock( $fromReplica=true, $disableIpBlockExemptChecking=false)
Get the block affecting the user, or null if the user is not blocked.
Definition User.php:1991
isBlockedFrom( $title, $fromReplica=false)
Check if user is blocked from editing a particular article.
Definition User.php:2007
Class representing a MediaWiki article and history.
Definition WikiPage.php:51
Interface for objects which can provide a MediaWiki context on request.
canUseWikiPage()
Check whether a WikiPage object can be get with getWikiPage().
getWikiPage()
Get the WikiPage object.
Interface for localizing messages in MediaWiki.
Interface for type hinting (accepts WikiPage, Article, ImagePage, CategoryPage)
Definition Page.php:30
if($IP===false)
Definition status.php:5