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  ->getGroupPermissionsLookup()
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 
346  protected function displayRestrictionError() {
347  throw new PermissionsError( $this->mRestriction );
348  }
349 
358  public function checkPermissions() {
359  if ( !$this->userCanExecute( $this->getUser() ) ) {
360  $this->displayRestrictionError();
361  }
362  }
363 
371  public function checkReadOnly() {
372  if ( wfReadOnly() ) {
373  throw new ReadOnlyError;
374  }
375  }
376 
388  public function requireLogin(
389  $reasonMsg = 'exception-nologin-text', $titleMsg = 'exception-nologin'
390  ) {
391  if ( $this->getUser()->isAnon() ) {
392  throw new UserNotLoggedIn( $reasonMsg, $titleMsg );
393  }
394  }
395 
404  protected function getLoginSecurityLevel() {
405  return false;
406  }
407 
425  protected function setReauthPostData( array $data ) {
426  }
427 
453  protected function checkLoginSecurityLevel( $level = null ) {
454  $level = $level ?: $this->getName();
455  $key = 'SpecialPage:reauth:' . $this->getName();
456  $request = $this->getRequest();
457 
458  $securityStatus = $this->getAuthManager()->securitySensitiveOperationStatus( $level );
459  if ( $securityStatus === AuthManager::SEC_OK ) {
460  $uniqueId = $request->getVal( 'postUniqueId' );
461  if ( $uniqueId ) {
462  $key .= ':' . $uniqueId;
463  $session = $request->getSession();
464  $data = $session->getSecret( $key );
465  if ( $data ) {
466  $session->remove( $key );
467  $this->setReauthPostData( $data );
468  }
469  }
470  return true;
471  } elseif ( $securityStatus === AuthManager::SEC_REAUTH ) {
472  $title = self::getTitleFor( 'Userlogin' );
473  $queryParams = $request->getQueryValues();
474 
475  if ( $request->wasPosted() ) {
476  $data = array_diff_assoc( $request->getValues(), $request->getQueryValues() );
477  if ( $data ) {
478  // unique ID in case the same special page is open in multiple browser tabs
479  $uniqueId = MWCryptRand::generateHex( 6 );
480  $key .= ':' . $uniqueId;
481  $queryParams['postUniqueId'] = $uniqueId;
482  $session = $request->getSession();
483  $session->persist(); // Just in case
484  $session->setSecret( $key, $data );
485  }
486  }
487 
488  $query = [
489  'returnto' => $this->getFullTitle()->getPrefixedDBkey(),
490  'returntoquery' => wfArrayToCgi( array_diff_key( $queryParams, [ 'title' => true ] ) ),
491  'force' => $level,
492  ];
493  $url = $title->getFullURL( $query, false, PROTO_HTTPS );
494 
495  $this->getOutput()->redirect( $url );
496  return false;
497  }
498 
499  $titleMessage = wfMessage( 'specialpage-securitylevel-not-allowed-title' );
500  $errorMessage = wfMessage( 'specialpage-securitylevel-not-allowed' );
501  throw new ErrorPageError( $titleMessage, $errorMessage );
502  }
503 
510  final protected function setAuthManager( AuthManager $authManager ) {
511  $this->authManager = $authManager;
512  }
513 
520  final protected function getAuthManager(): AuthManager {
521  if ( $this->authManager === null ) {
522  // Fallback if not provided
523  // TODO Change to wfWarn in a future release
524  $this->authManager = MediaWikiServices::getInstance()->getAuthManager();
525  }
526  return $this->authManager;
527  }
528 
546  public function prefixSearchSubpages( $search, $limit, $offset ) {
547  $subpages = $this->getSubpagesForPrefixSearch();
548  if ( !$subpages ) {
549  return [];
550  }
551 
552  return self::prefixSearchArray( $search, $limit, $subpages, $offset );
553  }
554 
564  protected function getSubpagesForPrefixSearch() {
565  return [];
566  }
567 
577  protected function prefixSearchString( $search, $limit, $offset, SearchEngineFactory $searchEngineFactory = null ) {
578  $title = Title::newFromText( $search );
579  if ( !$title || !$title->canExist() ) {
580  // No prefix suggestion in special and media namespace
581  return [];
582  }
583 
584  $searchEngine = $searchEngineFactory
586  // Fallback if not provided
587  // TODO Change to wfWarn in a future release
588  : MediaWikiServices::getInstance()->newSearchEngine();
589  $searchEngine->setLimitOffset( $limit, $offset );
590  $searchEngine->setNamespaces( [] );
591  $result = $searchEngine->defaultPrefixSearch( $search );
592  return array_map( static function ( Title $t ) {
593  return $t->getPrefixedText();
594  }, $result );
595  }
596 
608  protected static function prefixSearchArray( $search, $limit, array $subpages, $offset ) {
609  $escaped = preg_quote( $search, '/' );
610  return array_slice( preg_grep( "/^$escaped/i",
611  array_slice( $subpages, $offset ) ), 0, $limit );
612  }
613 
618  protected function setHeaders() {
619  $out = $this->getOutput();
620  $out->setArticleRelated( false );
621  $out->setRobotPolicy( $this->getRobotPolicy() );
622  $out->setPageTitle( $this->getDescription() );
623  if ( $this->getConfig()->get( 'UseMediaWikiUIEverywhere' ) ) {
624  $out->addModuleStyles( [
625  'mediawiki.ui.input',
626  'mediawiki.ui.radio',
627  'mediawiki.ui.checkbox',
628  ] );
629  }
630  }
631 
639  final public function run( $subPage ) {
640  if ( !$this->getHookRunner()->onSpecialPageBeforeExecute( $this, $subPage ) ) {
641  return;
642  }
643 
644  if ( $this->beforeExecute( $subPage ) === false ) {
645  return;
646  }
647  $this->execute( $subPage );
648  $this->afterExecute( $subPage );
649 
650  $this->getHookRunner()->onSpecialPageAfterExecute( $this, $subPage );
651  }
652 
663  protected function beforeExecute( $subPage ) {
664  // No-op
665  }
666 
675  protected function afterExecute( $subPage ) {
676  // No-op
677  }
678 
689  public function execute( $subPage ) {
690  $this->setHeaders();
691  $this->checkPermissions();
692  $securityLevel = $this->getLoginSecurityLevel();
693  if ( $securityLevel !== false && !$this->checkLoginSecurityLevel( $securityLevel ) ) {
694  return;
695  }
696  $this->outputHeader();
697  }
698 
709  protected function outputHeader( $summaryMessageKey = '' ) {
710  if ( $summaryMessageKey == '' ) {
711  $msg = $this->getContentLanguage()->lc( $this->getName() ) .
712  '-summary';
713  } else {
714  $msg = $summaryMessageKey;
715  }
716  if ( !$this->msg( $msg )->isDisabled() && !$this->including() ) {
717  $this->getOutput()->wrapWikiMsg(
718  "<div class='mw-specialpage-summary'>\n$1\n</div>", $msg );
719  }
720  }
721 
733  public function getDescription() {
734  return $this->msg( strtolower( $this->mName ) )->text();
735  }
736 
744  public function getPageTitle( $subpage = false ) {
745  return self::getTitleFor( $this->mName, $subpage );
746  }
747 
754  public function setContext( $context ) {
755  $this->mContext = $context;
756  }
757 
764  public function getContext() {
765  if ( !( $this->mContext instanceof IContextSource ) ) {
766  wfDebug( __METHOD__ . " called and \$mContext is null. " .
767  "Using RequestContext::getMain(); for sanity" );
768 
769  $this->mContext = RequestContext::getMain();
770  }
771  return $this->mContext;
772  }
773 
780  public function getRequest() {
781  return $this->getContext()->getRequest();
782  }
783 
790  public function getOutput() {
791  return $this->getContext()->getOutput();
792  }
793 
800  public function getUser() {
801  return $this->getContext()->getUser();
802  }
803 
810  public function getAuthority(): Authority {
811  return $this->getContext()->getAuthority();
812  }
813 
820  public function getSkin() {
821  return $this->getContext()->getSkin();
822  }
823 
830  public function getLanguage() {
831  return $this->getContext()->getLanguage();
832  }
833 
840  final public function getContentLanguage(): Language {
841  if ( $this->contentLanguage === null ) {
842  // Fallback if not provided
843  // TODO Change to wfWarn in a future release
844  $this->contentLanguage = MediaWikiServices::getInstance()->getContentLanguage();
845  }
846  return $this->contentLanguage;
847  }
848 
856  final public function setContentLanguage( Language $contentLanguage ) {
857  $this->contentLanguage = $contentLanguage;
858  }
859 
867  protected function getLanguageConverter(): ILanguageConverter {
868  wfDeprecated( __METHOD__, '1.36' );
869  return MediaWikiServices::getInstance()->getLanguageConverterFactory()
870  ->getLanguageConverter();
871  }
872 
878  public function getConfig() {
879  return $this->getContext()->getConfig();
880  }
881 
888  public function getFullTitle() {
889  return $this->getContext()->getTitle();
890  }
891 
899  protected function getRobotPolicy() {
900  return 'noindex,nofollow';
901  }
902 
912  public function msg( $key, ...$params ) {
913  $message = $this->getContext()->msg( $key, ...$params );
914  // RequestContext passes context to wfMessage, and the language is set from
915  // the context, but setting the language for Message class removes the
916  // interface message status, which breaks for example usernameless gender
917  // invocations. Restore the flag when not including special page in content.
918  if ( $this->including() ) {
919  $message->setInterfaceMessageFlag( false );
920  }
921 
922  return $message;
923  }
924 
930  protected function addFeedLinks( $params ) {
931  $feedTemplate = wfScript( 'api' );
932 
933  foreach ( $this->getConfig()->get( 'FeedClasses' ) as $format => $class ) {
934  $theseParams = $params + [ 'feedformat' => $format ];
935  $url = wfAppendQuery( $feedTemplate, $theseParams );
936  $this->getOutput()->addFeedLink( $format, $url );
937  }
938  }
939 
948  public function addHelpLink( $to, $overrideBaseUrl = false ) {
949  if ( $this->including() ) {
950  return;
951  }
952 
953  $msg = $this->msg( $this->getContentLanguage()->lc( $this->getName() ) . '-helppage' );
954 
955  if ( !$msg->isDisabled() ) {
956  $title = Title::newFromText( $msg->plain() );
957  if ( $title instanceof Title ) {
958  $this->getOutput()->addHelpLink( $title->getLocalURL(), true );
959  }
960  } else {
961  $this->getOutput()->addHelpLink( $to, $overrideBaseUrl );
962  }
963  }
964 
973  public function getFinalGroupName() {
974  $name = $this->getName();
975 
976  // Allow overriding the group from the wiki side
977  $msg = $this->msg( 'specialpages-specialpagegroup-' . strtolower( $name ) )->inContentLanguage();
978  if ( !$msg->isBlank() ) {
979  $group = $msg->text();
980  } else {
981  // Than use the group from this object
982  $group = $this->getGroupName();
983  }
984 
985  return $group;
986  }
987 
996  public function doesWrites() {
997  return false;
998  }
999 
1010  protected function getGroupName() {
1011  return 'other';
1012  }
1013 
1018  protected function useTransactionalTimeLimit() {
1019  if ( $this->getRequest()->wasPosted() ) {
1021  }
1022  }
1023 
1028  public function getLinkRenderer(): LinkRenderer {
1029  if ( $this->linkRenderer === null ) {
1030  // TODO Inject the service
1031  $this->linkRenderer = MediaWikiServices::getInstance()->getLinkRendererFactory()
1032  ->create();
1033  }
1034  return $this->linkRenderer;
1035  }
1036 
1042  $this->linkRenderer = $linkRenderer;
1043  }
1044 
1055  protected function buildPrevNextNavigation(
1056  $offset,
1057  $limit,
1058  array $query = [],
1059  $atend = false,
1060  $subpage = false
1061  ) {
1062  $title = $this->getPageTitle( $subpage );
1063  $prevNext = new PrevNextNavigationRenderer( $this );
1064 
1065  return $prevNext->buildPrevNextNavigation( $title, $offset, $limit, $query, $atend );
1066  }
1067 
1074  $this->hookContainer = $hookContainer;
1075  $this->hookRunner = new HookRunner( $hookContainer );
1076  }
1077 
1082  protected function getHookContainer() {
1083  if ( !$this->hookContainer ) {
1084  $this->hookContainer = MediaWikiServices::getInstance()->getHookContainer();
1085  }
1086  return $this->hookContainer;
1087  }
1088 
1095  protected function getHookRunner() {
1096  if ( !$this->hookRunner ) {
1097  $this->hookRunner = new HookRunner( $this->getHookContainer() );
1098  }
1099  return $this->hookRunner;
1100  }
1101 
1108  $this->specialPageFactory = $specialPageFactory;
1109  }
1110 
1115  final protected function getSpecialPageFactory(): SpecialPageFactory {
1116  if ( !$this->specialPageFactory ) {
1117  // Fallback if not provided
1118  // TODO Change to wfWarn in a future release
1119  $this->specialPageFactory = MediaWikiServices::getInstance()->getSpecialPageFactory();
1120  }
1122  }
1123 }
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:744
SpecialPage\getFinalGroupName
getFinalGroupName()
Get the group that the special page belongs in on Special:SpecialPage Use this method,...
Definition: SpecialPage.php:973
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:912
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:382
PROTO_HTTPS
const PROTO_HTTPS
Definition: Defines.php:193
SpecialPage\$specialPageFactory
SpecialPageFactory $specialPageFactory
Definition: SpecialPage.php:91
SpecialPage\getOutput
getOutput()
Get the OutputPage being used for this instance.
Definition: SpecialPage.php:790
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:199
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:1010
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:1512
MediaWiki\Linker\LinkRenderer
Class that generates HTML links for pages.
Definition: LinkRenderer.php:43
MediaWiki\SpecialPage\SpecialPageFactory
Factory for handling the special page list and generating SpecialPage objects.
Definition: SpecialPageFactory.php:63
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:358
SpecialPage\setReauthPostData
setReauthPostData(array $data)
Record preserved POST data after a reauthentication.
Definition: SpecialPage.php:425
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:346
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
$searchEngineFactory
SearchEngineFactory null $searchEngineFactory
Definition: SearchApi.php:33
wfReadOnly
wfReadOnly()
Check whether the wiki is in read-only mode.
Definition: GlobalFunctions.php:1098
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:1183
SearchEngineFactory
Factory class for SearchEngine.
Definition: SearchEngineFactory.php:12
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:1082
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:820
SpecialPage\useTransactionalTimeLimit
useTransactionalTimeLimit()
Call wfTransactionalTimeLimit() if this request was POSTed.
Definition: SpecialPage.php:1018
SpecialPage\getAuthority
getAuthority()
Shortcut to get the Authority executing this instance.
Definition: SpecialPage.php:810
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:830
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:577
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:422
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:733
SpecialPage\addHelpLink
addHelpLink( $to, $overrideBaseUrl=false)
Adds help link with an icon via page indicators.
Definition: SpecialPage.php:948
SpecialPage\getHookRunner
getHookRunner()
Definition: SpecialPage.php:1095
SpecialPage\getConfig
getConfig()
Shortcut to get main config object.
Definition: SpecialPage.php:878
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:930
wfDeprecated
wfDeprecated( $function, $version=false, $component=false, $callerOffset=2)
Logs a warning that a deprecated feature was used.
Definition: GlobalFunctions.php:997
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:2282
SpecialPage\checkLoginSecurityLevel
checkLoginSecurityLevel( $level=null)
Verifies that the user meets the security level, possibly reauthenticating them in the process.
Definition: SpecialPage.php:453
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:2390
SpecialPage\getFullTitle
getFullTitle()
Return the full title, including $par.
Definition: SpecialPage.php:888
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:510
$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:618
SpecialPage\getUser
getUser()
Shortcut to get the User executing this instance.
Definition: SpecialPage.php:800
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:675
SpecialPage\beforeExecute
beforeExecute( $subPage)
Gets called before.
Definition: SpecialPage.php:663
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:894
SpecialPage\setSpecialPageFactory
setSpecialPageFactory(SpecialPageFactory $specialPageFactory)
Definition: SpecialPage.php:1107
SpecialPage\$hookContainer
HookContainer null $hookContainer
Definition: SpecialPage.php:83
SpecialPage\getContext
getContext()
Gets the context this SpecialPage is executed in.
Definition: SpecialPage.php:764
SpecialPage\requireLogin
requireLogin( $reasonMsg='exception-nologin-text', $titleMsg='exception-nologin')
If the user is not logged in, throws UserNotLoggedIn error.
Definition: SpecialPage.php:388
SpecialPage\setLinkRenderer
setLinkRenderer(LinkRenderer $linkRenderer)
Definition: SpecialPage.php:1041
MediaWiki\Permissions\Authority
This interface represents the authority associated the current execution context, such as a web reque...
Definition: Authority.php:37
Title\makeTitleSafe
static makeTitleSafe( $ns, $title, $fragment='', $interwiki='')
Create a new Title from a namespace index and a DB key.
Definition: Title.php:676
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:899
ILanguageConverter
The shared interface for all language converters.
Definition: ILanguageConverter.php:29
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:608
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:1055
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:780
SpecialPage\getLoginSecurityLevel
getLoginSecurityLevel()
Tells if the special page does something security-sensitive and needs extra defense against a stolen ...
Definition: SpecialPage.php:404
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:484
Title\newFromLinkTarget
static newFromLinkTarget(LinkTarget $linkTarget, $forceClone='')
Returns a Title given a LinkTarget.
Definition: Title.php:294
SpecialPage\run
run( $subPage)
Entry point.
Definition: SpecialPage.php:639
SpecialPage\execute
execute( $subPage)
Default execute method Checks user permissions.
Definition: SpecialPage.php:689
MediaWiki\Auth\AuthManager
This serves as the entry point to the authentication system.
Definition: AuthManager.php:102
IContextSource
Interface for objects which can provide a MediaWiki context on request.
Definition: IContextSource.php:58
SpecialPage\getLinkRenderer
getLinkRenderer()
Definition: SpecialPage.php:1028
SpecialPage\setContentLanguage
setContentLanguage(Language $contentLanguage)
Set content language.
Definition: SpecialPage.php:856
Title
Represents a title within MediaWiki.
Definition: Title.php:47
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:564
SpecialPage\getAuthManager
getAuthManager()
Definition: SpecialPage.php:520
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:546
SpecialPage\getSpecialPageFactory
getSpecialPageFactory()
Definition: SpecialPage.php:1115
SpecialPage\setContext
setContext( $context)
Sets the context this SpecialPage is executed in.
Definition: SpecialPage.php:754
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
SearchEngineFactory\create
create( $type=null)
Create SearchEngine of the given type.
Definition: SearchEngineFactory.php:46
SpecialPage\setHookContainer
setHookContainer(HookContainer $hookContainer)
Definition: SpecialPage.php:1073
SpecialPage\getLanguageConverter
getLanguageConverter()
Shortcut to get language's converter.
Definition: SpecialPage.php:867
MediaWiki\HookContainer\HookRunner
This class provides an implementation of the core hook interfaces, forwarding hook calls to HookConta...
Definition: HookRunner.php:557
SpecialPage\doesWrites
doesWrites()
Indicates whether this special page may perform database writes.
Definition: SpecialPage.php:996
SpecialPage\getContentLanguage
getContentLanguage()
Shortcut to get content language.
Definition: SpecialPage.php:840
SpecialPage\checkReadOnly
checkReadOnly()
If the wiki is currently in readonly mode, throws a ReadOnlyError.
Definition: SpecialPage.php:371
$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:68
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:709
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:42
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:330