MediaWiki fundraising/REL1_35
SpecialPage.php
Go to the documentation of this file.
1<?php
30
41class SpecialPage implements MessageLocalizer {
42 // The canonical name of this special page
43 // Also used for the default <h1> heading, @see getDescription()
44 protected $mName;
45
46 // The local name of this special page
47 private $mLocalName;
48
49 // Minimum user level required to access this page, or "" for anyone.
50 // Also used to categorise the pages in Special:Specialpages
51 protected $mRestriction;
52
53 // Listed in Special:Specialpages?
54 private $mListed;
55
56 // Whether or not this special page is being included from an article
57 protected $mIncluding;
58
59 // Whether the special page can be included in an article
60 protected $mIncludable;
61
66 protected $mContext;
67
72
76 private $hookRunner;
77
92 public static function getTitleFor( $name, $subpage = false, $fragment = '' ) {
93 return Title::newFromLinkTarget(
94 self::getTitleValueFor( $name, $subpage, $fragment )
95 );
96 }
97
107 public static function getTitleValueFor( $name, $subpage = false, $fragment = '' ) {
108 $name = MediaWikiServices::getInstance()->getSpecialPageFactory()->
109 getLocalNameFor( $name, $subpage );
110
111 return new TitleValue( NS_SPECIAL, $name, $fragment );
112 }
113
121 public static function getSafeTitleFor( $name, $subpage = false ) {
122 $name = MediaWikiServices::getInstance()->getSpecialPageFactory()->
123 getLocalNameFor( $name, $subpage );
124 if ( $name ) {
125 return Title::makeTitleSafe( NS_SPECIAL, $name );
126 } else {
127 return null;
128 }
129 }
130
150 public function __construct(
151 $name = '', $restriction = '', $listed = true,
152 $function = false, $file = '', $includable = false
153 ) {
154 $this->mName = $name;
155 $this->mRestriction = $restriction;
156 $this->mListed = $listed;
157 $this->mIncludable = $includable;
158 }
159
164 public function getName() {
165 return $this->mName;
166 }
167
172 public function getRestriction() {
173 return $this->mRestriction;
174 }
175
176 // @todo FIXME: Decide which syntax to use for this, and stick to it
177
184 public function isListed() {
185 return $this->mListed;
186 }
187
196 public function setListed( $listed ) {
197 wfDeprecated( __METHOD__, '1.35' );
198 return wfSetVar( $this->mListed, $listed );
199 }
200
209 public function listed( $x = null ) {
210 wfDeprecated( __METHOD__, '1.35' );
211 return wfSetVar( $this->mListed, $x );
212 }
213
219 public function isIncludable() {
220 return $this->mIncludable;
221 }
222
234 public function maxIncludeCacheTime() {
235 return $this->getConfig()->get( 'MiserMode' ) ? $this->getCacheTTL() : 0;
236 }
237
242 protected function getCacheTTL() {
243 return 60 * 60;
244 }
245
251 public function including( $x = null ) {
252 return wfSetVar( $this->mIncluding, $x );
253 }
254
260 public function getLocalName() {
261 if ( !isset( $this->mLocalName ) ) {
262 $this->mLocalName = MediaWikiServices::getInstance()->getSpecialPageFactory()->
263 getLocalNameFor( $this->mName );
264 }
265
266 return $this->mLocalName;
267 }
268
278 public function isExpensive() {
279 return false;
280 }
281
292 public function isCached() {
293 return false;
294 }
295
304 public function isRestricted() {
305 // DWIM: If anons can do something, then it is not restricted
306 return $this->mRestriction != '' && !MediaWikiServices::getInstance()
307 ->getPermissionManager()
308 ->groupHasPermission( '*', $this->mRestriction );
309 }
310
320 public function userCanExecute( User $user ) {
321 return MediaWikiServices::getInstance()
322 ->getPermissionManager()
323 ->userHasRight( $user, $this->mRestriction );
324 }
325
331 protected function displayRestrictionError() {
332 throw new PermissionsError( $this->mRestriction );
333 }
334
343 public function checkPermissions() {
344 if ( !$this->userCanExecute( $this->getUser() ) ) {
346 }
347 }
348
356 public function checkReadOnly() {
357 if ( wfReadOnly() ) {
358 throw new ReadOnlyError;
359 }
360 }
361
373 public function requireLogin(
374 $reasonMsg = 'exception-nologin-text', $titleMsg = 'exception-nologin'
375 ) {
376 if ( $this->getUser()->isAnon() ) {
377 throw new UserNotLoggedIn( $reasonMsg, $titleMsg );
378 }
379 }
380
389 protected function getLoginSecurityLevel() {
390 return false;
391 }
392
408 protected function setReauthPostData( array $data ) {
409 }
410
436 protected function checkLoginSecurityLevel( $level = null ) {
437 $level = $level ?: $this->getName();
438 $key = 'SpecialPage:reauth:' . $this->getName();
439 $request = $this->getRequest();
440
441 $securityStatus = MediaWikiServices::getInstance()->getAuthManager()
442 ->securitySensitiveOperationStatus( $level );
443 if ( $securityStatus === AuthManager::SEC_OK ) {
444 $uniqueId = $request->getVal( 'postUniqueId' );
445 if ( $uniqueId ) {
446 $key .= ':' . $uniqueId;
447 $session = $request->getSession();
448 $data = $session->getSecret( $key );
449 if ( $data ) {
450 $session->remove( $key );
451 $this->setReauthPostData( $data );
452 }
453 }
454 return true;
455 } elseif ( $securityStatus === AuthManager::SEC_REAUTH ) {
456 $title = self::getTitleFor( 'Userlogin' );
457 $queryParams = $request->getQueryValues();
458
459 if ( $request->wasPosted() ) {
460 $data = array_diff_assoc( $request->getValues(), $request->getQueryValues() );
461 if ( $data ) {
462 // unique ID in case the same special page is open in multiple browser tabs
463 $uniqueId = MWCryptRand::generateHex( 6 );
464 $key .= ':' . $uniqueId;
465 $queryParams['postUniqueId'] = $uniqueId;
466 $session = $request->getSession();
467 $session->persist(); // Just in case
468 $session->setSecret( $key, $data );
469 }
470 }
471
472 $query = [
473 'returnto' => $this->getFullTitle()->getPrefixedDBkey(),
474 'returntoquery' => wfArrayToCgi( array_diff_key( $queryParams, [ 'title' => true ] ) ),
475 'force' => $level,
476 ];
477 $url = $title->getFullURL( $query, false, PROTO_HTTPS );
478
479 $this->getOutput()->redirect( $url );
480 return false;
481 }
482
483 $titleMessage = wfMessage( 'specialpage-securitylevel-not-allowed-title' );
484 $errorMessage = wfMessage( 'specialpage-securitylevel-not-allowed' );
485 throw new ErrorPageError( $titleMessage, $errorMessage );
486 }
487
505 public function prefixSearchSubpages( $search, $limit, $offset ) {
506 $subpages = $this->getSubpagesForPrefixSearch();
507 if ( !$subpages ) {
508 return [];
509 }
510
511 return self::prefixSearchArray( $search, $limit, $subpages, $offset );
512 }
513
523 protected function getSubpagesForPrefixSearch() {
524 return [];
525 }
526
534 protected function prefixSearchString( $search, $limit, $offset ) {
535 $title = Title::newFromText( $search );
536 if ( !$title || !$title->canExist() ) {
537 // No prefix suggestion in special and media namespace
538 return [];
539 }
540
541 $searchEngine = MediaWikiServices::getInstance()->newSearchEngine();
542 $searchEngine->setLimitOffset( $limit, $offset );
543 $searchEngine->setNamespaces( [] );
544 $result = $searchEngine->defaultPrefixSearch( $search );
545 return array_map( function ( Title $t ) {
546 return $t->getPrefixedText();
547 }, $result );
548 }
549
561 protected static function prefixSearchArray( $search, $limit, array $subpages, $offset ) {
562 $escaped = preg_quote( $search, '/' );
563 return array_slice( preg_grep( "/^$escaped/i",
564 array_slice( $subpages, $offset ) ), 0, $limit );
565 }
566
571 protected function setHeaders() {
572 $out = $this->getOutput();
573 $out->setArticleRelated( false );
574 $out->setRobotPolicy( $this->getRobotPolicy() );
575 $out->setPageTitle( $this->getDescription() );
576 if ( $this->getConfig()->get( 'UseMediaWikiUIEverywhere' ) ) {
577 $out->addModuleStyles( [
578 'mediawiki.ui.input',
579 'mediawiki.ui.radio',
580 'mediawiki.ui.checkbox',
581 ] );
582 }
583 }
584
592 final public function run( $subPage ) {
593 if ( !$this->getHookRunner()->onSpecialPageBeforeExecute( $this, $subPage ) ) {
594 return;
595 }
596
597 if ( $this->beforeExecute( $subPage ) === false ) {
598 return;
599 }
600 $this->execute( $subPage );
601 $this->afterExecute( $subPage );
602
603 $this->getHookRunner()->onSpecialPageAfterExecute( $this, $subPage );
604 }
605
616 protected function beforeExecute( $subPage ) {
617 // No-op
618 }
619
628 protected function afterExecute( $subPage ) {
629 // No-op
630 }
631
642 public function execute( $subPage ) {
643 $this->setHeaders();
644 $this->checkPermissions();
645 $securityLevel = $this->getLoginSecurityLevel();
646 if ( $securityLevel !== false && !$this->checkLoginSecurityLevel( $securityLevel ) ) {
647 return;
648 }
649 $this->outputHeader();
650 }
651
662 protected function outputHeader( $summaryMessageKey = '' ) {
663 if ( $summaryMessageKey == '' ) {
664 $msg = MediaWikiServices::getInstance()->getContentLanguage()->lc( $this->getName() ) .
665 '-summary';
666 } else {
667 $msg = $summaryMessageKey;
668 }
669 if ( !$this->msg( $msg )->isDisabled() && !$this->including() ) {
670 $this->getOutput()->wrapWikiMsg(
671 "<div class='mw-specialpage-summary'>\n$1\n</div>", $msg );
672 }
673 }
674
686 public function getDescription() {
687 return $this->msg( strtolower( $this->mName ) )->text();
688 }
689
697 public function getPageTitle( $subpage = false ) {
698 return self::getTitleFor( $this->mName, $subpage );
699 }
700
707 public function setContext( $context ) {
708 $this->mContext = $context;
709 }
710
717 public function getContext() {
718 if ( $this->mContext instanceof IContextSource ) {
719 return $this->mContext;
720 } else {
721 wfDebug( __METHOD__ . " called and \$mContext is null. " .
722 "Return RequestContext::getMain(); for sanity" );
723
724 return RequestContext::getMain();
725 }
726 }
727
734 public function getRequest() {
735 return $this->getContext()->getRequest();
736 }
737
744 public function getOutput() {
745 return $this->getContext()->getOutput();
746 }
747
754 public function getUser() {
755 return $this->getContext()->getUser();
756 }
757
764 public function getSkin() {
765 return $this->getContext()->getSkin();
766 }
767
774 public function getLanguage() {
775 return $this->getContext()->getLanguage();
776 }
777
785 return MediaWikiServices::getInstance()->getLanguageConverterFactory()
787 }
788
794 public function getConfig() {
795 return $this->getContext()->getConfig();
796 }
797
804 public function getFullTitle() {
805 return $this->getContext()->getTitle();
806 }
807
815 protected function getRobotPolicy() {
816 return 'noindex,nofollow';
817 }
818
828 public function msg( $key, ...$params ) {
829 $message = $this->getContext()->msg( $key, ...$params );
830 // RequestContext passes context to wfMessage, and the language is set from
831 // the context, but setting the language for Message class removes the
832 // interface message status, which breaks for example usernameless gender
833 // invocations. Restore the flag when not including special page in content.
834 if ( $this->including() ) {
835 $message->setInterfaceMessageFlag( false );
836 }
837
838 return $message;
839 }
840
846 protected function addFeedLinks( $params ) {
847 $feedTemplate = wfScript( 'api' );
848
849 foreach ( $this->getConfig()->get( 'FeedClasses' ) as $format => $class ) {
850 $theseParams = $params + [ 'feedformat' => $format ];
851 $url = wfAppendQuery( $feedTemplate, $theseParams );
852 $this->getOutput()->addFeedLink( $format, $url );
853 }
854 }
855
864 public function addHelpLink( $to, $overrideBaseUrl = false ) {
865 if ( $this->including() ) {
866 return;
867 }
868
869 $msg = $this->msg(
870 MediaWikiServices::getInstance()->getContentLanguage()->lc( $this->getName() ) .
871 '-helppage' );
872
873 if ( !$msg->isDisabled() ) {
874 $helpUrl = Skin::makeUrl( $msg->plain() );
875 $this->getOutput()->addHelpLink( $helpUrl, true );
876 } else {
877 $this->getOutput()->addHelpLink( $to, $overrideBaseUrl );
878 }
879 }
880
889 public function getFinalGroupName() {
890 $name = $this->getName();
891
892 // Allow overriding the group from the wiki side
893 $msg = $this->msg( 'specialpages-specialpagegroup-' . strtolower( $name ) )->inContentLanguage();
894 if ( !$msg->isBlank() ) {
895 $group = $msg->text();
896 } else {
897 // Than use the group from this object
898 $group = $this->getGroupName();
899 }
900
901 return $group;
902 }
903
912 public function doesWrites() {
913 return false;
914 }
915
926 protected function getGroupName() {
927 return 'other';
928 }
929
934 protected function useTransactionalTimeLimit() {
935 if ( $this->getRequest()->wasPosted() ) {
937 }
938 }
939
944 public function getLinkRenderer() {
945 if ( $this->linkRenderer ) {
946 return $this->linkRenderer;
947 } else {
948 return MediaWikiServices::getInstance()->getLinkRenderer();
949 }
950 }
951
956 public function setLinkRenderer( LinkRenderer $linkRenderer ) {
957 $this->linkRenderer = $linkRenderer;
958 }
959
970 protected function buildPrevNextNavigation(
971 $offset,
972 $limit,
973 array $query = [],
974 $atend = false,
975 $subpage = false
976 ) {
977 $title = $this->getPageTitle( $subpage );
978 $prevNext = new PrevNextNavigationRenderer( $this );
979
980 return $prevNext->buildPrevNextNavigation( $title, $offset, $limit, $query, $atend );
981 }
982
988 public function setHookContainer( HookContainer $hookContainer ) {
989 $this->hookContainer = $hookContainer;
990 $this->hookRunner = new HookRunner( $hookContainer );
991 }
992
997 protected function getHookContainer() {
998 if ( !$this->hookContainer ) {
999 $this->hookContainer = MediaWikiServices::getInstance()->getHookContainer();
1000 }
1001 return $this->hookContainer;
1002 }
1003
1010 protected function getHookRunner() {
1011 if ( !$this->hookRunner ) {
1012 $this->hookRunner = new HookRunner( $this->getHookContainer() );
1013 }
1014 return $this->hookRunner;
1015 }
1016}
wfDebug( $text, $dest='all', array $context=[])
Sends a line to the debug log if enabled or, optionally, to a comment in output.
wfReadOnly()
Check whether the wiki is in read-only mode.
wfSetVar(&$dest, $source, $force=false)
Sets dest to source and returns the original value of dest If source is NULL, it just returns the val...
wfTransactionalTimeLimit()
Set PHP's time limit to the larger of php.ini or $wgTransactionalTimeLimit.
wfAppendQuery( $url, $query)
Append a query string to an existing URL, which may or may not already have query string parameters a...
wfArrayToCgi( $array1, $array2=null, $prefix='')
This function takes one or two arrays as input, and returns a CGI-style string, e....
wfScript( $script='index')
Get the path to a specified script file, respecting file extensions; this is a wrapper around $wgScri...
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,]
An error page which can definitely be safely rendered using the OutputPage.
Some internal bits split of from Skin.php.
Definition Linker.php:36
static generateHex( $chars)
Generate a run of cryptographically random data and return it in hexadecimal string format.
This serves as the entry point to the authentication system.
This class provides an implementation of the core hook interfaces, forwarding hook calls to HookConta...
Class that generates HTML links for pages.
MediaWikiServices is the service locator for the application scope of MediaWiki.
Helper class for generating prev/next links for paging.
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...
Parent class for all special pages.
__construct( $name='', $restriction='', $listed=true, $function=false, $file='', $includable=false)
Default constructor for special pages Derivative classes should call this from their constructor Note...
outputHeader( $summaryMessageKey='')
Outputs a summary message on top of special pages Per default the message key is the canonical name o...
setContext( $context)
Sets the context this SpecialPage is executed in.
getGroupName()
Under which header this special page is listed in Special:SpecialPages See messages 'specialpages-gro...
setHookContainer(HookContainer $hookContainer)
getName()
Get the name of this Special Page.
setHeaders()
Sets headers - this should be called from the execute() method of all derived classes!...
static getSafeTitleFor( $name, $subpage=false)
Get a localised Title object for a page name with a possibly unvalidated subpage.
getLocalName()
Get the localised name of the special page Stable to override.
afterExecute( $subPage)
Gets called after.
getRestriction()
Get the permission that a user must have to execute this page.
getDescription()
Returns the name that goes in the <h1> in the special page itself, and also the name that will be l...
run( $subPage)
Entry point.
getOutput()
Get the OutputPage being used for this instance.
getLanguageConverter()
Shortcut to get language's converter.
requireLogin( $reasonMsg='exception-nologin-text', $titleMsg='exception-nologin')
If the user is not logged in, throws UserNotLoggedIn error.
beforeExecute( $subPage)
Gets called before.
checkLoginSecurityLevel( $level=null)
Verifies that the user meets the security level, possibly reauthenticating them in the process.
getUser()
Shortcut to get the User executing this instance.
static prefixSearchArray( $search, $limit, array $subpages, $offset)
Helper function for implementations of prefixSearchSubpages() that filter the values in memory (as op...
setListed( $listed)
Set whether this page is listed in Special:Specialpages, at run-time.
buildPrevNextNavigation( $offset, $limit, array $query=[], $atend=false, $subpage=false)
Generate (prev x| next x) (20|50|100...) type links for paging.
isListed()
Whether this special page is listed in Special:SpecialPages Stable to override.
getSkin()
Shortcut to get the skin being used for this instance.
checkPermissions()
Checks if userCanExecute, and if not throws a PermissionsError.
execute( $subPage)
Default execute method Checks user permissions.
static getTitleFor( $name, $subpage=false, $fragment='')
Get a localised Title object for a specified special page name If you don't need a full Title object,...
isCached()
Is this page cached? Expensive pages are cached or disabled in miser mode.
addFeedLinks( $params)
Adds RSS/atom links.
setReauthPostData(array $data)
Record preserved POST data after a reauthentication.
getContext()
Gets the context this SpecialPage is executed in.
HookContainer null $hookContainer
msg( $key,... $params)
Wrapper around wfMessage that sets the current context.
HookRunner null $hookRunner
getConfig()
Shortcut to get main config object.
listed( $x=null)
Get or set whether this special page is listed in Special:SpecialPages.
doesWrites()
Indicates whether this special page may perform database writes.
getRequest()
Get the WebRequest being used for this instance.
getFinalGroupName()
Get the group that the special page belongs in on Special:SpecialPage Use this method,...
checkReadOnly()
If the wiki is currently in readonly mode, throws a ReadOnlyError.
displayRestrictionError()
Output an error message telling the user what access level they have to have Stable to override.
static getTitleValueFor( $name, $subpage=false, $fragment='')
Get a localised TitleValue object for a specified special page name.
getSubpagesForPrefixSearch()
Return an array of subpages that this special page will accept for prefix searches.
getPageTitle( $subpage=false)
Get a self-referential title object.
useTransactionalTimeLimit()
Call wfTransactionalTimeLimit() if this request was POSTed.
getLanguage()
Shortcut to get user's language.
addHelpLink( $to, $overrideBaseUrl=false)
Adds help link with an icon via page indicators.
getLoginSecurityLevel()
Tells if the special page does something security-sensitive and needs extra defense against a stolen ...
setLinkRenderer(LinkRenderer $linkRenderer)
IContextSource $mContext
Current request context.
including( $x=null)
Whether the special page is being evaluated via transclusion.
maxIncludeCacheTime()
How long to cache page when it is being included.
prefixSearchString( $search, $limit, $offset)
Perform a regular substring search for prefixSearchSubpages.
getCacheTTL()
Stable to override.
isRestricted()
Can be overridden by subclasses with more complicated permissions schemes.
MediaWiki Linker LinkRenderer null $linkRenderer
prefixSearchSubpages( $search, $limit, $offset)
Return an array of subpages beginning with $search that this special page will accept.
userCanExecute(User $user)
Checks if the given user (identified by an object) can execute this special page (as defined by $mRes...
getFullTitle()
Return the full title, including $par.
getRobotPolicy()
Return the robot policy.
isExpensive()
Is this page expensive (for some definition of expensive)? Expensive pages are disabled or cached in ...
isIncludable()
Whether it's allowed to transclude the special page via {{Special:Foo/params}} Stable to override.
Represents a page (or page fragment) title within MediaWiki.
Represents a title within MediaWiki.
Definition Title.php:42
Redirect a user to the login page.
The User object encapsulates all of the user-specific settings (user_id, name, rights,...
Definition User.php:60
const PROTO_HTTPS
Definition Defines.php:210
const NS_SPECIAL
Definition Defines.php:59
Interface for objects which can provide a MediaWiki context on request.
The shared interface for all language converters.
Interface for localizing messages in MediaWiki.
A helper class for throttling authentication attempts.
if(PHP_SAPI !='cli-server') if(!isset( $_SERVER['SCRIPT_FILENAME'])) $file
Item class for a filearchive table row.
Definition router.php:42