MediaWiki  master
SpecialPage.php
Go to the documentation of this file.
1 <?php
32 
43 class SpecialPage implements MessageLocalizer {
48  protected $mName;
49 
51  private $mLocalName;
52 
57  protected $mRestriction;
58 
60  private $mListed;
61 
63  protected $mIncluding;
64 
66  protected $mIncludable;
67 
72  protected $mContext;
73 
76 
80  private $linkRenderer = null;
81 
83  private $hookContainer;
85  private $hookRunner;
86 
88  private $authManager = null;
89 
92 
107  public static function getTitleFor( $name, $subpage = false, $fragment = '' ) {
109  self::getTitleValueFor( $name, $subpage, $fragment )
110  );
111  }
112 
122  public static function getTitleValueFor( $name, $subpage = false, $fragment = '' ) {
123  $name = MediaWikiServices::getInstance()->getSpecialPageFactory()->
124  getLocalNameFor( $name, $subpage );
125 
126  return new TitleValue( NS_SPECIAL, $name, $fragment );
127  }
128 
136  public static function getSafeTitleFor( $name, $subpage = false ) {
137  $name = MediaWikiServices::getInstance()->getSpecialPageFactory()->
138  getLocalNameFor( $name, $subpage );
139  if ( $name ) {
140  return Title::makeTitleSafe( NS_SPECIAL, $name );
141  } else {
142  return null;
143  }
144  }
145 
165  public function __construct(
166  $name = '', $restriction = '', $listed = true,
167  $function = false, $file = '', $includable = false
168  ) {
169  $this->mName = $name;
170  $this->mRestriction = $restriction;
171  $this->mListed = $listed;
172  $this->mIncludable = $includable;
173  }
174 
179  public function getName() {
180  return $this->mName;
181  }
182 
187  public function getRestriction() {
188  return $this->mRestriction;
189  }
190 
191  // @todo FIXME: Decide which syntax to use for this, and stick to it
192 
199  public function isListed() {
200  return $this->mListed;
201  }
202 
211  public function setListed( $listed ) {
212  wfDeprecated( __METHOD__, '1.35' );
213  return wfSetVar( $this->mListed, $listed );
214  }
215 
224  public function listed( $x = null ) {
225  wfDeprecated( __METHOD__, '1.35' );
226  return wfSetVar( $this->mListed, $x );
227  }
228 
234  public function isIncludable() {
235  return $this->mIncludable;
236  }
237 
249  public function maxIncludeCacheTime() {
250  return $this->getConfig()->get( 'MiserMode' ) ? $this->getCacheTTL() : 0;
251  }
252 
257  protected function getCacheTTL() {
258  return 60 * 60;
259  }
260 
266  public function including( $x = null ) {
267  return wfSetVar( $this->mIncluding, $x );
268  }
269 
275  public function getLocalName() {
276  if ( !isset( $this->mLocalName ) ) {
277  $this->mLocalName = $this->getSpecialPageFactory()->getLocalNameFor( $this->mName );
278  }
279 
280  return $this->mLocalName;
281  }
282 
292  public function isExpensive() {
293  return false;
294  }
295 
306  public function isCached() {
307  return false;
308  }
309 
318  public function isRestricted() {
319  // DWIM: If anons can do something, then it is not restricted
320  return $this->mRestriction != '' && !MediaWikiServices::getInstance()
321  ->getPermissionManager()
322  ->groupHasPermission( '*', $this->mRestriction );
323  }
324 
334  public function userCanExecute( User $user ) {
335  return MediaWikiServices::getInstance()
336  ->getPermissionManager()
337  ->userHasRight( $user, $this->mRestriction );
338  }
339 
345  protected function displayRestrictionError() {
346  throw new PermissionsError( $this->mRestriction );
347  }
348 
357  public function checkPermissions() {
358  if ( !$this->userCanExecute( $this->getUser() ) ) {
359  $this->displayRestrictionError();
360  }
361  }
362 
370  public function checkReadOnly() {
371  if ( wfReadOnly() ) {
372  throw new ReadOnlyError;
373  }
374  }
375 
387  public function requireLogin(
388  $reasonMsg = 'exception-nologin-text', $titleMsg = 'exception-nologin'
389  ) {
390  if ( $this->getUser()->isAnon() ) {
391  throw new UserNotLoggedIn( $reasonMsg, $titleMsg );
392  }
393  }
394 
403  protected function getLoginSecurityLevel() {
404  return false;
405  }
406 
424  protected function setReauthPostData( array $data ) {
425  }
426 
452  protected function checkLoginSecurityLevel( $level = null ) {
453  $level = $level ?: $this->getName();
454  $key = 'SpecialPage:reauth:' . $this->getName();
455  $request = $this->getRequest();
456 
457  $securityStatus = $this->getAuthManager()->securitySensitiveOperationStatus( $level );
458  if ( $securityStatus === AuthManager::SEC_OK ) {
459  $uniqueId = $request->getVal( 'postUniqueId' );
460  if ( $uniqueId ) {
461  $key .= ':' . $uniqueId;
462  $session = $request->getSession();
463  $data = $session->getSecret( $key );
464  if ( $data ) {
465  $session->remove( $key );
466  $this->setReauthPostData( $data );
467  }
468  }
469  return true;
470  } elseif ( $securityStatus === AuthManager::SEC_REAUTH ) {
471  $title = self::getTitleFor( 'Userlogin' );
472  $queryParams = $request->getQueryValues();
473 
474  if ( $request->wasPosted() ) {
475  $data = array_diff_assoc( $request->getValues(), $request->getQueryValues() );
476  if ( $data ) {
477  // unique ID in case the same special page is open in multiple browser tabs
478  $uniqueId = MWCryptRand::generateHex( 6 );
479  $key .= ':' . $uniqueId;
480  $queryParams['postUniqueId'] = $uniqueId;
481  $session = $request->getSession();
482  $session->persist(); // Just in case
483  $session->setSecret( $key, $data );
484  }
485  }
486 
487  $query = [
488  'returnto' => $this->getFullTitle()->getPrefixedDBkey(),
489  'returntoquery' => wfArrayToCgi( array_diff_key( $queryParams, [ 'title' => true ] ) ),
490  'force' => $level,
491  ];
492  $url = $title->getFullURL( $query, false, PROTO_HTTPS );
493 
494  $this->getOutput()->redirect( $url );
495  return false;
496  }
497 
498  $titleMessage = wfMessage( 'specialpage-securitylevel-not-allowed-title' );
499  $errorMessage = wfMessage( 'specialpage-securitylevel-not-allowed' );
500  throw new ErrorPageError( $titleMessage, $errorMessage );
501  }
502 
509  final protected function setAuthManager( AuthManager $authManager ) {
510  $this->authManager = $authManager;
511  }
512 
519  final protected function getAuthManager(): AuthManager {
520  if ( $this->authManager === null ) {
521  // Fallback if not provided
522  // TODO Change to wfWarn in a future release
523  $this->authManager = MediaWikiServices::getInstance()->getAuthManager();
524  }
525  return $this->authManager;
526  }
527 
545  public function prefixSearchSubpages( $search, $limit, $offset ) {
546  $subpages = $this->getSubpagesForPrefixSearch();
547  if ( !$subpages ) {
548  return [];
549  }
550 
551  return self::prefixSearchArray( $search, $limit, $subpages, $offset );
552  }
553 
563  protected function getSubpagesForPrefixSearch() {
564  return [];
565  }
566 
576  protected function prefixSearchString( $search, $limit, $offset, SearchEngineFactory $searchEngineFactory = null ) {
577  $title = Title::newFromText( $search );
578  if ( !$title || !$title->canExist() ) {
579  // No prefix suggestion in special and media namespace
580  return [];
581  }
582 
583  $searchEngine = $searchEngineFactory
584  ? $searchEngineFactory->create()
585  // Fallback if not provided
586  // TODO Change to wfWarn in a future release
587  : MediaWikiServices::getInstance()->newSearchEngine();
588  $searchEngine->setLimitOffset( $limit, $offset );
589  $searchEngine->setNamespaces( [] );
590  $result = $searchEngine->defaultPrefixSearch( $search );
591  return array_map( static function ( Title $t ) {
592  return $t->getPrefixedText();
593  }, $result );
594  }
595 
607  protected static function prefixSearchArray( $search, $limit, array $subpages, $offset ) {
608  $escaped = preg_quote( $search, '/' );
609  return array_slice( preg_grep( "/^$escaped/i",
610  array_slice( $subpages, $offset ) ), 0, $limit );
611  }
612 
617  protected function setHeaders() {
618  $out = $this->getOutput();
619  $out->setArticleRelated( false );
620  $out->setRobotPolicy( $this->getRobotPolicy() );
621  $out->setPageTitle( $this->getDescription() );
622  if ( $this->getConfig()->get( 'UseMediaWikiUIEverywhere' ) ) {
623  $out->addModuleStyles( [
624  'mediawiki.ui.input',
625  'mediawiki.ui.radio',
626  'mediawiki.ui.checkbox',
627  ] );
628  }
629  }
630 
638  final public function run( $subPage ) {
639  if ( !$this->getHookRunner()->onSpecialPageBeforeExecute( $this, $subPage ) ) {
640  return;
641  }
642 
643  if ( $this->beforeExecute( $subPage ) === false ) {
644  return;
645  }
646  $this->execute( $subPage );
647  $this->afterExecute( $subPage );
648 
649  $this->getHookRunner()->onSpecialPageAfterExecute( $this, $subPage );
650  }
651 
662  protected function beforeExecute( $subPage ) {
663  // No-op
664  }
665 
674  protected function afterExecute( $subPage ) {
675  // No-op
676  }
677 
688  public function execute( $subPage ) {
689  $this->setHeaders();
690  $this->checkPermissions();
691  $securityLevel = $this->getLoginSecurityLevel();
692  if ( $securityLevel !== false && !$this->checkLoginSecurityLevel( $securityLevel ) ) {
693  return;
694  }
695  $this->outputHeader();
696  }
697 
708  protected function outputHeader( $summaryMessageKey = '' ) {
709  if ( $summaryMessageKey == '' ) {
710  $msg = $this->getContentLanguage()->lc( $this->getName() ) .
711  '-summary';
712  } else {
713  $msg = $summaryMessageKey;
714  }
715  if ( !$this->msg( $msg )->isDisabled() && !$this->including() ) {
716  $this->getOutput()->wrapWikiMsg(
717  "<div class='mw-specialpage-summary'>\n$1\n</div>", $msg );
718  }
719  }
720 
732  public function getDescription() {
733  return $this->msg( strtolower( $this->mName ) )->text();
734  }
735 
743  public function getPageTitle( $subpage = false ) {
744  return self::getTitleFor( $this->mName, $subpage );
745  }
746 
753  public function setContext( $context ) {
754  $this->mContext = $context;
755  }
756 
763  public function getContext() {
764  if ( !( $this->mContext instanceof IContextSource ) ) {
765  wfDebug( __METHOD__ . " called and \$mContext is null. " .
766  "Using RequestContext::getMain(); for sanity" );
767 
768  $this->mContext = RequestContext::getMain();
769  }
770  return $this->mContext;
771  }
772 
779  public function getRequest() {
780  return $this->getContext()->getRequest();
781  }
782 
789  public function getOutput() {
790  return $this->getContext()->getOutput();
791  }
792 
799  public function getUser() {
800  return $this->getContext()->getUser();
801  }
802 
809  public function getAuthority(): Authority {
810  return $this->getContext()->getAuthority();
811  }
812 
819  public function getSkin() {
820  return $this->getContext()->getSkin();
821  }
822 
829  public function getLanguage() {
830  return $this->getContext()->getLanguage();
831  }
832 
839  final public function getContentLanguage(): Language {
840  if ( $this->contentLanguage === null ) {
841  // Fallback if not provided
842  // TODO Change to wfWarn in a future release
843  $this->contentLanguage = MediaWikiServices::getInstance()->getContentLanguage();
844  }
845  return $this->contentLanguage;
846  }
847 
855  final public function setContentLanguage( Language $contentLanguage ) {
856  $this->contentLanguage = $contentLanguage;
857  }
858 
866  protected function getLanguageConverter(): ILanguageConverter {
867  wfDeprecated( __METHOD__, '1.36' );
868  return MediaWikiServices::getInstance()->getLanguageConverterFactory()
869  ->getLanguageConverter();
870  }
871 
877  public function getConfig() {
878  return $this->getContext()->getConfig();
879  }
880 
887  public function getFullTitle() {
888  return $this->getContext()->getTitle();
889  }
890 
898  protected function getRobotPolicy() {
899  return 'noindex,nofollow';
900  }
901 
911  public function msg( $key, ...$params ) {
912  $message = $this->getContext()->msg( $key, ...$params );
913  // RequestContext passes context to wfMessage, and the language is set from
914  // the context, but setting the language for Message class removes the
915  // interface message status, which breaks for example usernameless gender
916  // invocations. Restore the flag when not including special page in content.
917  if ( $this->including() ) {
918  $message->setInterfaceMessageFlag( false );
919  }
920 
921  return $message;
922  }
923 
929  protected function addFeedLinks( $params ) {
930  $feedTemplate = wfScript( 'api' );
931 
932  foreach ( $this->getConfig()->get( 'FeedClasses' ) as $format => $class ) {
933  $theseParams = $params + [ 'feedformat' => $format ];
934  $url = wfAppendQuery( $feedTemplate, $theseParams );
935  $this->getOutput()->addFeedLink( $format, $url );
936  }
937  }
938 
947  public function addHelpLink( $to, $overrideBaseUrl = false ) {
948  if ( $this->including() ) {
949  return;
950  }
951 
952  $msg = $this->msg( $this->getContentLanguage()->lc( $this->getName() ) . '-helppage' );
953 
954  if ( !$msg->isDisabled() ) {
955  $title = Title::newFromText( $msg->plain() );
956  if ( $title instanceof Title ) {
957  $this->getOutput()->addHelpLink( $title->getLocalURL(), true );
958  }
959  } else {
960  $this->getOutput()->addHelpLink( $to, $overrideBaseUrl );
961  }
962  }
963 
972  public function getFinalGroupName() {
973  $name = $this->getName();
974 
975  // Allow overriding the group from the wiki side
976  $msg = $this->msg( 'specialpages-specialpagegroup-' . strtolower( $name ) )->inContentLanguage();
977  if ( !$msg->isBlank() ) {
978  $group = $msg->text();
979  } else {
980  // Than use the group from this object
981  $group = $this->getGroupName();
982  }
983 
984  return $group;
985  }
986 
995  public function doesWrites() {
996  return false;
997  }
998 
1009  protected function getGroupName() {
1010  return 'other';
1011  }
1012 
1017  protected function useTransactionalTimeLimit() {
1018  if ( $this->getRequest()->wasPosted() ) {
1020  }
1021  }
1022 
1027  public function getLinkRenderer(): LinkRenderer {
1028  if ( $this->linkRenderer === null ) {
1029  // TODO Inject the service
1030  $this->linkRenderer = MediaWikiServices::getInstance()->getLinkRendererFactory()
1031  ->createForUser( $this->getUser() );
1032  }
1033  return $this->linkRenderer;
1034  }
1035 
1041  $this->linkRenderer = $linkRenderer;
1042  }
1043 
1054  protected function buildPrevNextNavigation(
1055  $offset,
1056  $limit,
1057  array $query = [],
1058  $atend = false,
1059  $subpage = false
1060  ) {
1061  $title = $this->getPageTitle( $subpage );
1062  $prevNext = new PrevNextNavigationRenderer( $this );
1063 
1064  return $prevNext->buildPrevNextNavigation( $title, $offset, $limit, $query, $atend );
1065  }
1066 
1073  $this->hookContainer = $hookContainer;
1074  $this->hookRunner = new HookRunner( $hookContainer );
1075  }
1076 
1081  protected function getHookContainer() {
1082  if ( !$this->hookContainer ) {
1083  $this->hookContainer = MediaWikiServices::getInstance()->getHookContainer();
1084  }
1085  return $this->hookContainer;
1086  }
1087 
1094  protected function getHookRunner() {
1095  if ( !$this->hookRunner ) {
1096  $this->hookRunner = new HookRunner( $this->getHookContainer() );
1097  }
1098  return $this->hookRunner;
1099  }
1100 
1107  $this->specialPageFactory = $specialPageFactory;
1108  }
1109 
1114  final protected function getSpecialPageFactory(): SpecialPageFactory {
1115  if ( !$this->specialPageFactory ) {
1116  // Fallback if not provided
1117  // TODO Change to wfWarn in a future release
1118  $this->specialPageFactory = MediaWikiServices::getInstance()->getSpecialPageFactory();
1119  }
1121  }
1122 }
ReadOnlyError
Show an error when the wiki is locked/read-only and the user tries to do something that requires writ...
Definition: ReadOnlyError.php:29
SpecialPage\$linkRenderer
LinkRenderer null $linkRenderer
Definition: SpecialPage.php:80
SpecialPage\getPageTitle
getPageTitle( $subpage=false)
Get a self-referential title object.
Definition: SpecialPage.php:743
SpecialPage\getFinalGroupName
getFinalGroupName()
Get the group that the special page belongs in on Special:SpecialPage Use this method,...
Definition: SpecialPage.php:972
SpecialPage\$mIncludable
bool $mIncludable
Whether the special page can be included in an article.
Definition: SpecialPage.php:66
SpecialPage\msg
msg( $key,... $params)
Wrapper around wfMessage that sets the current context.
Definition: SpecialPage.php:911
Title\newFromText
static newFromText( $text, $defaultNamespace=NS_MAIN)
Create a new Title from text, such as what one would find in a link.
Definition: Title.php:363
PROTO_HTTPS
const PROTO_HTTPS
Definition: Defines.php:204
SpecialPage\$specialPageFactory
SpecialPageFactory $specialPageFactory
Definition: SpecialPage.php:91
SpecialPage\getOutput
getOutput()
Get the OutputPage being used for this instance.
Definition: SpecialPage.php:789
SpecialPage\$mRestriction
string $mRestriction
Minimum user level required to access this page, or "" for anyone.
Definition: SpecialPage.php:57
SpecialPage\isExpensive
isExpensive()
Is this page expensive (for some definition of expensive)? Expensive pages are disabled or cached in ...
Definition: SpecialPage.php:292
MediaWiki\MediaWikiServices
MediaWikiServices is the service locator for the application scope of MediaWiki.
Definition: MediaWikiServices.php:173
SpecialPage\maxIncludeCacheTime
maxIncludeCacheTime()
How long to cache page when it is being included.
Definition: SpecialPage.php:249
SpecialPage\getGroupName
getGroupName()
Under which header this special page is listed in Special:SpecialPages See messages 'specialpages-gro...
Definition: SpecialPage.php:1009
wfSetVar
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...
Definition: GlobalFunctions.php:1561
MediaWiki\Linker\LinkRenderer
Class that generates HTML links for pages.
Definition: LinkRenderer.php:41
MediaWiki\SpecialPage\SpecialPageFactory
Factory for handling the special page list and generating SpecialPage objects.
Definition: SpecialPageFactory.php:61
UserNotLoggedIn
Redirect a user to the login page.
Definition: UserNotLoggedIn.php:54
SpecialPage\checkPermissions
checkPermissions()
Checks if userCanExecute, and if not throws a PermissionsError.
Definition: SpecialPage.php:357
SpecialPage\setReauthPostData
setReauthPostData(array $data)
Record preserved POST data after a reauthentication.
Definition: SpecialPage.php:424
SpecialPage\__construct
__construct( $name='', $restriction='', $listed=true, $function=false, $file='', $includable=false)
Default constructor for special pages Derivative classes should call this from their constructor Note...
Definition: SpecialPage.php:165
SpecialPage\displayRestrictionError
displayRestrictionError()
Output an error message telling the user what access level they have to have.
Definition: SpecialPage.php:345
SpecialPage\setListed
setListed( $listed)
Set whether this page is listed in Special:Specialpages, at run-time.
Definition: SpecialPage.php:211
$file
if(PHP_SAPI !='cli-server') if(!isset( $_SERVER['SCRIPT_FILENAME'])) $file
Item class for a filearchive table row.
Definition: router.php:42
wfReadOnly
wfReadOnly()
Check whether the wiki is in read-only mode.
Definition: GlobalFunctions.php:1135
SpecialPage\getLocalName
getLocalName()
Get the localised name of the special page.
Definition: SpecialPage.php:275
wfMessage
wfMessage( $key,... $params)
This is the function for getting translated interface messages.
Definition: GlobalFunctions.php:1231
SearchEngineFactory
Factory class for SearchEngine.
Definition: SearchEngineFactory.php:13
MediaWiki\Navigation\PrevNextNavigationRenderer
Helper class for generating prev/next links for paging.
Definition: PrevNextNavigationRenderer.php:33
SpecialPage\getTitleFor
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,...
Definition: SpecialPage.php:107
SpecialPage\getHookContainer
getHookContainer()
Definition: SpecialPage.php:1081
SpecialPage\$mContext
IContextSource $mContext
Current request context.
Definition: SpecialPage.php:72
SpecialPage\getSkin
getSkin()
Shortcut to get the skin being used for this instance.
Definition: SpecialPage.php:819
SpecialPage\useTransactionalTimeLimit
useTransactionalTimeLimit()
Call wfTransactionalTimeLimit() if this request was POSTed.
Definition: SpecialPage.php:1017
SpecialPage\getAuthority
getAuthority()
Shortcut to get the Authority executing this instance.
Definition: SpecialPage.php:809
PermissionsError
Show an error when a user tries to do something they do not have the necessary permissions for.
Definition: PermissionsError.php:32
SpecialPage\getLanguage
getLanguage()
Shortcut to get user's language.
Definition: SpecialPage.php:829
SpecialPage\getName
getName()
Get the name of this Special Page.
Definition: SpecialPage.php:179
SpecialPage\isListed
isListed()
Whether this special page is listed in Special:SpecialPages.
Definition: SpecialPage.php:199
SpecialPage\$authManager
AuthManager null $authManager
Definition: SpecialPage.php:88
MessageLocalizer
Interface for localizing messages in MediaWiki.
Definition: MessageLocalizer.php:29
SpecialPage\getRestriction
getRestriction()
Get the permission that a user must have to execute this page.
Definition: SpecialPage.php:187
NS_SPECIAL
const NS_SPECIAL
Definition: Defines.php:53
SpecialPage\prefixSearchString
prefixSearchString( $search, $limit, $offset, SearchEngineFactory $searchEngineFactory=null)
Perform a regular substring search for prefixSearchSubpages.
Definition: SpecialPage.php:576
wfAppendQuery
wfAppendQuery( $url, $query)
Append a query string to an existing URL, which may or may not already have query string parameters a...
Definition: GlobalFunctions.php:443
SpecialPage\getSafeTitleFor
static getSafeTitleFor( $name, $subpage=false)
Get a localised Title object for a page name with a possibly unvalidated subpage.
Definition: SpecialPage.php:136
SpecialPage\getDescription
getDescription()
Returns the name that goes in the <h1> in the special page itself, and also the name that will be l...
Definition: SpecialPage.php:732
SpecialPage\addHelpLink
addHelpLink( $to, $overrideBaseUrl=false)
Adds help link with an icon via page indicators.
Definition: SpecialPage.php:947
SpecialPage\getHookRunner
getHookRunner()
Definition: SpecialPage.php:1094
SpecialPage\getConfig
getConfig()
Shortcut to get main config object.
Definition: SpecialPage.php:877
SpecialPage\$mIncluding
bool $mIncluding
Whether or not this special page is being included from an article.
Definition: SpecialPage.php:63
SpecialPage\addFeedLinks
addFeedLinks( $params)
Adds RSS/atom links.
Definition: SpecialPage.php:929
wfDeprecated
wfDeprecated( $function, $version=false, $component=false, $callerOffset=2)
Logs a warning that $function is deprecated.
Definition: GlobalFunctions.php:1034
SpecialPage\$contentLanguage
Language null $contentLanguage
Definition: SpecialPage.php:75
SpecialPage\getCacheTTL
getCacheTTL()
Definition: SpecialPage.php:257
wfScript
wfScript( $script='index')
Get the path to a specified script file, respecting file extensions; this is a wrapper around $wgScri...
Definition: GlobalFunctions.php:2534
SpecialPage\checkLoginSecurityLevel
checkLoginSecurityLevel( $level=null)
Verifies that the user meets the security level, possibly reauthenticating them in the process.
Definition: SpecialPage.php:452
SpecialPage\getTitleValueFor
static getTitleValueFor( $name, $subpage=false, $fragment='')
Get a localised TitleValue object for a specified special page name.
Definition: SpecialPage.php:122
wfTransactionalTimeLimit
wfTransactionalTimeLimit()
Raise the request time limit to $wgTransactionalTimeLimit.
Definition: GlobalFunctions.php:2642
SpecialPage\getFullTitle
getFullTitle()
Return the full title, including $par.
Definition: SpecialPage.php:887
SpecialPage\isRestricted
isRestricted()
Can be overridden by subclasses with more complicated permissions schemes.
Definition: SpecialPage.php:318
SpecialPage\setAuthManager
setAuthManager(AuthManager $authManager)
Set the injected AuthManager from the special page constructor.
Definition: SpecialPage.php:509
$title
$title
Definition: testCompression.php:38
SpecialPage\setHeaders
setHeaders()
Sets headers - this should be called from the execute() method of all derived classes!
Definition: SpecialPage.php:617
SpecialPage\getUser
getUser()
Shortcut to get the User executing this instance.
Definition: SpecialPage.php:799
SpecialPage\isIncludable
isIncludable()
Whether it's allowed to transclude the special page via {{Special:Foo/params}}.
Definition: SpecialPage.php:234
SpecialPage\afterExecute
afterExecute( $subPage)
Gets called after.
Definition: SpecialPage.php:674
SpecialPage\beforeExecute
beforeExecute( $subPage)
Gets called before.
Definition: SpecialPage.php:662
wfDebug
wfDebug( $text, $dest='all', array $context=[])
Sends a line to the debug log if enabled or, optionally, to a comment in output.
Definition: GlobalFunctions.php:915
SpecialPage\setSpecialPageFactory
setSpecialPageFactory(SpecialPageFactory $specialPageFactory)
Definition: SpecialPage.php:1106
SpecialPage\$hookContainer
HookContainer null $hookContainer
Definition: SpecialPage.php:83
SpecialPage\getContext
getContext()
Gets the context this SpecialPage is executed in.
Definition: SpecialPage.php:763
SpecialPage\requireLogin
requireLogin( $reasonMsg='exception-nologin-text', $titleMsg='exception-nologin')
If the user is not logged in, throws UserNotLoggedIn error.
Definition: SpecialPage.php:387
SpecialPage\setLinkRenderer
setLinkRenderer(LinkRenderer $linkRenderer)
Definition: SpecialPage.php:1040
MediaWiki\Permissions\Authority
Definition: Authority.php:30
Title\makeTitleSafe
static makeTitleSafe( $ns, $title, $fragment='', $interwiki='')
Create a new Title from a namespace index and a DB key.
Definition: Title.php:652
SpecialPage\userCanExecute
userCanExecute(User $user)
Checks if the given user (identified by an object) can execute this special page (as defined by $mRes...
Definition: SpecialPage.php:334
SpecialPage\getRobotPolicy
getRobotPolicy()
Return the robot policy.
Definition: SpecialPage.php:898
ILanguageConverter
The shared interface for all language converters.
Definition: ILanguageConverter.php:28
SpecialPage\prefixSearchArray
static prefixSearchArray( $search, $limit, array $subpages, $offset)
Helper function for implementations of prefixSearchSubpages() that filter the values in memory (as op...
Definition: SpecialPage.php:607
SpecialPage
Parent class for all special pages.
Definition: SpecialPage.php:43
SpecialPage\listed
listed( $x=null)
Get or set whether this special page is listed in Special:SpecialPages.
Definition: SpecialPage.php:224
SpecialPage\buildPrevNextNavigation
buildPrevNextNavigation( $offset, $limit, array $query=[], $atend=false, $subpage=false)
Generate (prev x| next x) (20|50|100...) type links for paging.
Definition: SpecialPage.php:1054
SpecialPage\isCached
isCached()
Is this page cached? Expensive pages are cached or disabled in miser mode.
Definition: SpecialPage.php:306
SpecialPage\getRequest
getRequest()
Get the WebRequest being used for this instance.
Definition: SpecialPage.php:779
SpecialPage\getLoginSecurityLevel
getLoginSecurityLevel()
Tells if the special page does something security-sensitive and needs extra defense against a stolen ...
Definition: SpecialPage.php:403
MWCryptRand\generateHex
static generateHex( $chars)
Generate a run of cryptographically random data and return it in hexadecimal string format.
Definition: MWCryptRand.php:36
RequestContext\getMain
static getMain()
Get the RequestContext object associated with the main request.
Definition: RequestContext.php:476
Title\newFromLinkTarget
static newFromLinkTarget(LinkTarget $linkTarget, $forceClone='')
Returns a Title given a LinkTarget.
Definition: Title.php:291
SpecialPage\run
run( $subPage)
Entry point.
Definition: SpecialPage.php:638
SpecialPage\execute
execute( $subPage)
Default execute method Checks user permissions.
Definition: SpecialPage.php:688
MediaWiki\Auth\AuthManager
This serves as the entry point to the authentication system.
Definition: AuthManager.php:93
IContextSource
Interface for objects which can provide a MediaWiki context on request.
Definition: IContextSource.php:57
SpecialPage\getLinkRenderer
getLinkRenderer()
Definition: SpecialPage.php:1027
SpecialPage\setContentLanguage
setContentLanguage(Language $contentLanguage)
Set content language.
Definition: SpecialPage.php:855
Title
Represents a title within MediaWiki.
Definition: Title.php:46
SpecialPage\$hookRunner
HookRunner null $hookRunner
Definition: SpecialPage.php:85
SpecialPage\getSubpagesForPrefixSearch
getSubpagesForPrefixSearch()
Return an array of subpages that this special page will accept for prefix searches.
Definition: SpecialPage.php:563
SpecialPage\getAuthManager
getAuthManager()
Definition: SpecialPage.php:519
SpecialPage\$mLocalName
string $mLocalName
The local name of this special page.
Definition: SpecialPage.php:51
SpecialPage\prefixSearchSubpages
prefixSearchSubpages( $search, $limit, $offset)
Return an array of subpages beginning with $search that this special page will accept.
Definition: SpecialPage.php:545
SpecialPage\getSpecialPageFactory
getSpecialPageFactory()
Definition: SpecialPage.php:1114
SpecialPage\setContext
setContext( $context)
Sets the context this SpecialPage is executed in.
Definition: SpecialPage.php:753
SpecialPage\$mName
string $mName
The canonical name of this special page Also used for the default.
Definition: SpecialPage.php:48
MediaWiki\HookContainer\HookContainer
HookContainer class.
Definition: HookContainer.php:45
SpecialPage\setHookContainer
setHookContainer(HookContainer $hookContainer)
Definition: SpecialPage.php:1072
SpecialPage\getLanguageConverter
getLanguageConverter()
Shortcut to get language's converter.
Definition: SpecialPage.php:866
MediaWiki\HookContainer\HookRunner
This class provides an implementation of the core hook interfaces, forwarding hook calls to HookConta...
Definition: HookRunner.php:576
SpecialPage\doesWrites
doesWrites()
Indicates whether this special page may perform database writes.
Definition: SpecialPage.php:995
SpecialPage\getContentLanguage
getContentLanguage()
Shortcut to get content language.
Definition: SpecialPage.php:839
SpecialPage\checkReadOnly
checkReadOnly()
If the wiki is currently in readonly mode, throws a ReadOnlyError.
Definition: SpecialPage.php:370
$t
$t
Definition: testCompression.php:74
ErrorPageError
An error page which can definitely be safely rendered using the OutputPage.
Definition: ErrorPageError.php:30
SpecialPage\$mListed
bool $mListed
Listed in Special:Specialpages?
Definition: SpecialPage.php:60
User
The User object encapsulates all of the user-specific settings (user_id, name, rights,...
Definition: User.php:66
SpecialPage\outputHeader
outputHeader( $summaryMessageKey='')
Outputs a summary message on top of special pages Per default the message key is the canonical name o...
Definition: SpecialPage.php:708
SpecialPage\including
including( $x=null)
Whether the special page is being evaluated via transclusion.
Definition: SpecialPage.php:266
Language
Internationalisation code See https://www.mediawiki.org/wiki/Special:MyLanguage/Localisation for more...
Definition: Language.php:43
TitleValue
Represents a page (or page fragment) title within MediaWiki.
Definition: TitleValue.php:40
wfArrayToCgi
wfArrayToCgi( $array1, $array2=null, $prefix='')
This function takes one or two arrays as input, and returns a CGI-style string, e....
Definition: GlobalFunctions.php:351