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 
103  public static function newSearchPage( User $user ) {
104  // Try user preference first
105  $userOptionsManager = MediaWikiServices::getInstance()->getUserOptionsManager();
106  $title = $userOptionsManager->getOption( $user, 'search-special-page' );
107  if ( $title ) {
108  $page = self::getTitleFor( $title );
109  $factory = MediaWikiServices::getInstance()->getSpecialPageFactory();
110  if ( $factory->exists( $page->getText() ) ) {
111  return $page;
112  }
113  }
114  return self::getTitleFor( 'Search' );
115  }
116 
131  public static function getTitleFor( $name, $subpage = false, $fragment = '' ) {
133  self::getTitleValueFor( $name, $subpage, $fragment )
134  );
135  }
136 
146  public static function getTitleValueFor( $name, $subpage = false, $fragment = '' ) {
147  $name = MediaWikiServices::getInstance()->getSpecialPageFactory()->
148  getLocalNameFor( $name, $subpage );
149 
150  return new TitleValue( NS_SPECIAL, $name, $fragment );
151  }
152 
160  public static function getSafeTitleFor( $name, $subpage = false ) {
161  $name = MediaWikiServices::getInstance()->getSpecialPageFactory()->
162  getLocalNameFor( $name, $subpage );
163  if ( $name ) {
164  return Title::makeTitleSafe( NS_SPECIAL, $name );
165  } else {
166  return null;
167  }
168  }
169 
189  public function __construct(
190  $name = '', $restriction = '', $listed = true,
191  $function = false, $file = '', $includable = false
192  ) {
193  $this->mName = $name;
194  $this->mRestriction = $restriction;
195  $this->mListed = $listed;
196  $this->mIncludable = $includable;
197  }
198 
203  public function getName() {
204  return $this->mName;
205  }
206 
211  public function getRestriction() {
212  return $this->mRestriction;
213  }
214 
215  // @todo FIXME: Decide which syntax to use for this, and stick to it
216 
223  public function isListed() {
224  return $this->mListed;
225  }
226 
235  public function setListed( $listed ) {
236  wfDeprecated( __METHOD__, '1.35' );
237  return wfSetVar( $this->mListed, $listed );
238  }
239 
248  public function listed( $x = null ) {
249  wfDeprecated( __METHOD__, '1.35' );
250  return wfSetVar( $this->mListed, $x );
251  }
252 
258  public function isIncludable() {
259  return $this->mIncludable;
260  }
261 
273  public function maxIncludeCacheTime() {
274  return $this->getConfig()->get( 'MiserMode' ) ? $this->getCacheTTL() : 0;
275  }
276 
281  protected function getCacheTTL() {
282  return 60 * 60;
283  }
284 
290  public function including( $x = null ) {
291  return wfSetVar( $this->mIncluding, $x );
292  }
293 
299  public function getLocalName() {
300  if ( !isset( $this->mLocalName ) ) {
301  $this->mLocalName = $this->getSpecialPageFactory()->getLocalNameFor( $this->mName );
302  }
303 
304  return $this->mLocalName;
305  }
306 
316  public function isExpensive() {
317  return false;
318  }
319 
330  public function isCached() {
331  return false;
332  }
333 
342  public function isRestricted() {
343  // DWIM: If anons can do something, then it is not restricted
344  return $this->mRestriction != '' && !MediaWikiServices::getInstance()
345  ->getGroupPermissionsLookup()
346  ->groupHasPermission( '*', $this->mRestriction );
347  }
348 
358  public function userCanExecute( User $user ) {
359  return MediaWikiServices::getInstance()
360  ->getPermissionManager()
361  ->userHasRight( $user, $this->mRestriction );
362  }
363 
370  protected function displayRestrictionError() {
371  throw new PermissionsError( $this->mRestriction );
372  }
373 
382  public function checkPermissions() {
383  if ( !$this->userCanExecute( $this->getUser() ) ) {
384  $this->displayRestrictionError();
385  }
386  }
387 
395  public function checkReadOnly() {
396  if ( wfReadOnly() ) {
397  throw new ReadOnlyError;
398  }
399  }
400 
412  public function requireLogin(
413  $reasonMsg = 'exception-nologin-text', $titleMsg = 'exception-nologin'
414  ) {
415  if ( $this->getUser()->isAnon() ) {
416  throw new UserNotLoggedIn( $reasonMsg, $titleMsg );
417  }
418  }
419 
428  protected function getLoginSecurityLevel() {
429  return false;
430  }
431 
449  protected function setReauthPostData( array $data ) {
450  }
451 
477  protected function checkLoginSecurityLevel( $level = null ) {
478  $level = $level ?: $this->getName();
479  $key = 'SpecialPage:reauth:' . $this->getName();
480  $request = $this->getRequest();
481 
482  $securityStatus = $this->getAuthManager()->securitySensitiveOperationStatus( $level );
483  if ( $securityStatus === AuthManager::SEC_OK ) {
484  $uniqueId = $request->getVal( 'postUniqueId' );
485  if ( $uniqueId ) {
486  $key .= ':' . $uniqueId;
487  $session = $request->getSession();
488  $data = $session->getSecret( $key );
489  if ( $data ) {
490  $session->remove( $key );
491  $this->setReauthPostData( $data );
492  }
493  }
494  return true;
495  } elseif ( $securityStatus === AuthManager::SEC_REAUTH ) {
496  $title = self::getTitleFor( 'Userlogin' );
497  $queryParams = $request->getQueryValues();
498 
499  if ( $request->wasPosted() ) {
500  $data = array_diff_assoc( $request->getValues(), $request->getQueryValues() );
501  if ( $data ) {
502  // unique ID in case the same special page is open in multiple browser tabs
503  $uniqueId = MWCryptRand::generateHex( 6 );
504  $key .= ':' . $uniqueId;
505  $queryParams['postUniqueId'] = $uniqueId;
506  $session = $request->getSession();
507  $session->persist(); // Just in case
508  $session->setSecret( $key, $data );
509  }
510  }
511 
512  $query = [
513  'returnto' => $this->getFullTitle()->getPrefixedDBkey(),
514  'returntoquery' => wfArrayToCgi( array_diff_key( $queryParams, [ 'title' => true ] ) ),
515  'force' => $level,
516  ];
517  $url = $title->getFullURL( $query, false, PROTO_HTTPS );
518 
519  $this->getOutput()->redirect( $url );
520  return false;
521  }
522 
523  $titleMessage = wfMessage( 'specialpage-securitylevel-not-allowed-title' );
524  $errorMessage = wfMessage( 'specialpage-securitylevel-not-allowed' );
525  throw new ErrorPageError( $titleMessage, $errorMessage );
526  }
527 
534  final protected function setAuthManager( AuthManager $authManager ) {
535  $this->authManager = $authManager;
536  }
537 
544  final protected function getAuthManager(): AuthManager {
545  if ( $this->authManager === null ) {
546  // Fallback if not provided
547  // TODO Change to wfWarn in a future release
548  $this->authManager = MediaWikiServices::getInstance()->getAuthManager();
549  }
550  return $this->authManager;
551  }
552 
570  public function prefixSearchSubpages( $search, $limit, $offset ) {
571  $subpages = $this->getSubpagesForPrefixSearch();
572  if ( !$subpages ) {
573  return [];
574  }
575 
576  return self::prefixSearchArray( $search, $limit, $subpages, $offset );
577  }
578 
588  protected function getSubpagesForPrefixSearch() {
589  return [];
590  }
591 
601  protected function prefixSearchString( $search, $limit, $offset, SearchEngineFactory $searchEngineFactory = null ) {
602  $title = Title::newFromText( $search );
603  if ( !$title || !$title->canExist() ) {
604  // No prefix suggestion in special and media namespace
605  return [];
606  }
607 
608  $searchEngine = $searchEngineFactory
610  // Fallback if not provided
611  // TODO Change to wfWarn in a future release
612  : MediaWikiServices::getInstance()->newSearchEngine();
613  $searchEngine->setLimitOffset( $limit, $offset );
614  $searchEngine->setNamespaces( [] );
615  $result = $searchEngine->defaultPrefixSearch( $search );
616  return array_map( static function ( Title $t ) {
617  return $t->getPrefixedText();
618  }, $result );
619  }
620 
632  protected static function prefixSearchArray( $search, $limit, array $subpages, $offset ) {
633  $escaped = preg_quote( $search, '/' );
634  return array_slice( preg_grep( "/^$escaped/i",
635  array_slice( $subpages, $offset ) ), 0, $limit );
636  }
637 
642  protected function setHeaders() {
643  $out = $this->getOutput();
644  $out->setArticleRelated( false );
645  $out->setRobotPolicy( $this->getRobotPolicy() );
646  $out->setPageTitle( $this->getDescription() );
647  if ( $this->getConfig()->get( 'UseMediaWikiUIEverywhere' ) ) {
648  $out->addModuleStyles( [
649  'mediawiki.ui.input',
650  'mediawiki.ui.radio',
651  'mediawiki.ui.checkbox',
652  ] );
653  }
654  }
655 
663  final public function run( $subPage ) {
664  if ( !$this->getHookRunner()->onSpecialPageBeforeExecute( $this, $subPage ) ) {
665  return;
666  }
667 
668  if ( $this->beforeExecute( $subPage ) === false ) {
669  return;
670  }
671  $this->execute( $subPage );
672  $this->afterExecute( $subPage );
673 
674  $this->getHookRunner()->onSpecialPageAfterExecute( $this, $subPage );
675  }
676 
687  protected function beforeExecute( $subPage ) {
688  // No-op
689  }
690 
699  protected function afterExecute( $subPage ) {
700  // No-op
701  }
702 
713  public function execute( $subPage ) {
714  $this->setHeaders();
715  $this->checkPermissions();
716  $securityLevel = $this->getLoginSecurityLevel();
717  if ( $securityLevel !== false && !$this->checkLoginSecurityLevel( $securityLevel ) ) {
718  return;
719  }
720  $this->outputHeader();
721  }
722 
733  protected function outputHeader( $summaryMessageKey = '' ) {
734  if ( $summaryMessageKey == '' ) {
735  $msg = $this->getContentLanguage()->lc( $this->getName() ) .
736  '-summary';
737  } else {
738  $msg = $summaryMessageKey;
739  }
740  if ( !$this->msg( $msg )->isDisabled() && !$this->including() ) {
741  $this->getOutput()->wrapWikiMsg(
742  "<div class='mw-specialpage-summary'>\n$1\n</div>", $msg );
743  }
744  }
745 
757  public function getDescription() {
758  return $this->msg( strtolower( $this->mName ) )->text();
759  }
760 
768  public function getPageTitle( $subpage = false ) {
769  return self::getTitleFor( $this->mName, $subpage );
770  }
771 
778  public function setContext( $context ) {
779  $this->mContext = $context;
780  }
781 
788  public function getContext() {
789  if ( !( $this->mContext instanceof IContextSource ) ) {
790  wfDebug( __METHOD__ . " called and \$mContext is null. " .
791  "Using RequestContext::getMain()" );
792 
793  $this->mContext = RequestContext::getMain();
794  }
795  return $this->mContext;
796  }
797 
804  public function getRequest() {
805  return $this->getContext()->getRequest();
806  }
807 
814  public function getOutput() {
815  return $this->getContext()->getOutput();
816  }
817 
824  public function getUser() {
825  return $this->getContext()->getUser();
826  }
827 
834  public function getAuthority(): Authority {
835  return $this->getContext()->getAuthority();
836  }
837 
844  public function getSkin() {
845  return $this->getContext()->getSkin();
846  }
847 
854  public function getLanguage() {
855  return $this->getContext()->getLanguage();
856  }
857 
864  final public function getContentLanguage(): Language {
865  if ( $this->contentLanguage === null ) {
866  // Fallback if not provided
867  // TODO Change to wfWarn in a future release
868  $this->contentLanguage = MediaWikiServices::getInstance()->getContentLanguage();
869  }
870  return $this->contentLanguage;
871  }
872 
880  final public function setContentLanguage( Language $contentLanguage ) {
881  $this->contentLanguage = $contentLanguage;
882  }
883 
891  protected function getLanguageConverter(): ILanguageConverter {
892  wfDeprecated( __METHOD__, '1.36' );
893  return MediaWikiServices::getInstance()->getLanguageConverterFactory()
894  ->getLanguageConverter();
895  }
896 
902  public function getConfig() {
903  return $this->getContext()->getConfig();
904  }
905 
912  public function getFullTitle() {
913  return $this->getContext()->getTitle();
914  }
915 
923  protected function getRobotPolicy() {
924  return 'noindex,nofollow';
925  }
926 
936  public function msg( $key, ...$params ) {
937  $message = $this->getContext()->msg( $key, ...$params );
938  // RequestContext passes context to wfMessage, and the language is set from
939  // the context, but setting the language for Message class removes the
940  // interface message status, which breaks for example usernameless gender
941  // invocations. Restore the flag when not including special page in content.
942  if ( $this->including() ) {
943  $message->setInterfaceMessageFlag( false );
944  }
945 
946  return $message;
947  }
948 
954  protected function addFeedLinks( $params ) {
955  $feedTemplate = wfScript( 'api' );
956 
957  foreach ( $this->getConfig()->get( 'FeedClasses' ) as $format => $class ) {
958  $theseParams = $params + [ 'feedformat' => $format ];
959  $url = wfAppendQuery( $feedTemplate, $theseParams );
960  $this->getOutput()->addFeedLink( $format, $url );
961  }
962  }
963 
972  public function addHelpLink( $to, $overrideBaseUrl = false ) {
973  if ( $this->including() ) {
974  return;
975  }
976 
977  $msg = $this->msg( $this->getContentLanguage()->lc( $this->getName() ) . '-helppage' );
978 
979  if ( !$msg->isDisabled() ) {
980  $title = Title::newFromText( $msg->plain() );
981  if ( $title instanceof Title ) {
982  $this->getOutput()->addHelpLink( $title->getLocalURL(), true );
983  }
984  } else {
985  $this->getOutput()->addHelpLink( $to, $overrideBaseUrl );
986  }
987  }
988 
997  public function getFinalGroupName() {
998  $name = $this->getName();
999 
1000  // Allow overriding the group from the wiki side
1001  $msg = $this->msg( 'specialpages-specialpagegroup-' . strtolower( $name ) )->inContentLanguage();
1002  if ( !$msg->isBlank() ) {
1003  $group = $msg->text();
1004  } else {
1005  // Than use the group from this object
1006  $group = $this->getGroupName();
1007  }
1008 
1009  return $group;
1010  }
1011 
1020  public function doesWrites() {
1021  return false;
1022  }
1023 
1034  protected function getGroupName() {
1035  return 'other';
1036  }
1037 
1042  protected function useTransactionalTimeLimit() {
1043  if ( $this->getRequest()->wasPosted() ) {
1045  }
1046  }
1047 
1052  public function getLinkRenderer(): LinkRenderer {
1053  if ( $this->linkRenderer === null ) {
1054  // TODO Inject the service
1055  $this->linkRenderer = MediaWikiServices::getInstance()->getLinkRendererFactory()
1056  ->create();
1057  }
1058  return $this->linkRenderer;
1059  }
1060 
1066  $this->linkRenderer = $linkRenderer;
1067  }
1068 
1079  protected function buildPrevNextNavigation(
1080  $offset,
1081  $limit,
1082  array $query = [],
1083  $atend = false,
1084  $subpage = false
1085  ) {
1086  $title = $this->getPageTitle( $subpage );
1087  $prevNext = new PrevNextNavigationRenderer( $this );
1088 
1089  return $prevNext->buildPrevNextNavigation( $title, $offset, $limit, $query, $atend );
1090  }
1091 
1098  $this->hookContainer = $hookContainer;
1099  $this->hookRunner = new HookRunner( $hookContainer );
1100  }
1101 
1106  protected function getHookContainer() {
1107  if ( !$this->hookContainer ) {
1108  $this->hookContainer = MediaWikiServices::getInstance()->getHookContainer();
1109  }
1110  return $this->hookContainer;
1111  }
1112 
1119  protected function getHookRunner() {
1120  if ( !$this->hookRunner ) {
1121  $this->hookRunner = new HookRunner( $this->getHookContainer() );
1122  }
1123  return $this->hookRunner;
1124  }
1125 
1132  $this->specialPageFactory = $specialPageFactory;
1133  }
1134 
1139  final protected function getSpecialPageFactory(): SpecialPageFactory {
1140  if ( !$this->specialPageFactory ) {
1141  // Fallback if not provided
1142  // TODO Change to wfWarn in a future release
1143  $this->specialPageFactory = MediaWikiServices::getInstance()->getSpecialPageFactory();
1144  }
1146  }
1147 }
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:768
SpecialPage\getFinalGroupName
getFinalGroupName()
Get the group that the special page belongs in on Special:SpecialPage Use this method,...
Definition: SpecialPage.php:997
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:936
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:377
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:814
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:316
MediaWiki\MediaWikiServices
MediaWikiServices is the service locator for the application scope of MediaWiki.
Definition: MediaWikiServices.php:203
SpecialPage\maxIncludeCacheTime
maxIncludeCacheTime()
How long to cache page when it is being included.
Definition: SpecialPage.php:273
SpecialPage\getGroupName
getGroupName()
Under which header this special page is listed in Special:SpecialPages See messages 'specialpages-gro...
Definition: SpecialPage.php:1034
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:1496
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:382
SpecialPage\setReauthPostData
setReauthPostData(array $data)
Record preserved POST data after a reauthentication.
Definition: SpecialPage.php:449
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:189
SpecialPage\displayRestrictionError
displayRestrictionError()
Output an error message telling the user what access level they have to have.
Definition: SpecialPage.php:370
SpecialPage\setListed
setListed( $listed)
Set whether this page is listed in Special:Specialpages, at run-time.
Definition: SpecialPage.php:235
$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:1082
SpecialPage\getLocalName
getLocalName()
Get the localised name of the special page.
Definition: SpecialPage.php:299
wfMessage
wfMessage( $key,... $params)
This is the function for getting translated interface messages.
Definition: GlobalFunctions.php:1167
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:131
SpecialPage\getHookContainer
getHookContainer()
Definition: SpecialPage.php:1106
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:844
SpecialPage\useTransactionalTimeLimit
useTransactionalTimeLimit()
Call wfTransactionalTimeLimit() if this request was POSTed.
Definition: SpecialPage.php:1042
SpecialPage\getAuthority
getAuthority()
Shortcut to get the Authority executing this instance.
Definition: SpecialPage.php:834
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:854
SpecialPage\getName
getName()
Get the name of this Special Page.
Definition: SpecialPage.php:203
SpecialPage\isListed
isListed()
Whether this special page is listed in Special:SpecialPages.
Definition: SpecialPage.php:223
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:211
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:601
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:160
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:757
SpecialPage\addHelpLink
addHelpLink( $to, $overrideBaseUrl=false)
Adds help link with an icon via page indicators.
Definition: SpecialPage.php:972
SpecialPage\getHookRunner
getHookRunner()
Definition: SpecialPage.php:1119
SpecialPage\getConfig
getConfig()
Shortcut to get main config object.
Definition: SpecialPage.php:902
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:954
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:281
wfScript
wfScript( $script='index')
Get the path to a specified script file, respecting file extensions; this is a wrapper around $wgScri...
Definition: GlobalFunctions.php:2268
SpecialPage\checkLoginSecurityLevel
checkLoginSecurityLevel( $level=null)
Verifies that the user meets the security level, possibly reauthenticating them in the process.
Definition: SpecialPage.php:477
SpecialPage\getTitleValueFor
static getTitleValueFor( $name, $subpage=false, $fragment='')
Get a localised TitleValue object for a specified special page name.
Definition: SpecialPage.php:146
wfTransactionalTimeLimit
wfTransactionalTimeLimit()
Raise the request time limit to $wgTransactionalTimeLimit.
Definition: GlobalFunctions.php:2376
SpecialPage\getFullTitle
getFullTitle()
Return the full title, including $par.
Definition: SpecialPage.php:912
SpecialPage\isRestricted
isRestricted()
Can be overridden by subclasses with more complicated permissions schemes.
Definition: SpecialPage.php:342
SpecialPage\setAuthManager
setAuthManager(AuthManager $authManager)
Set the injected AuthManager from the special page constructor.
Definition: SpecialPage.php:534
$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:642
SpecialPage\getUser
getUser()
Shortcut to get the User executing this instance.
Definition: SpecialPage.php:824
SpecialPage\isIncludable
isIncludable()
Whether it's allowed to transclude the special page via {{Special:Foo/params}}.
Definition: SpecialPage.php:258
SpecialPage\afterExecute
afterExecute( $subPage)
Gets called after.
Definition: SpecialPage.php:699
SpecialPage\beforeExecute
beforeExecute( $subPage)
Gets called before.
Definition: SpecialPage.php:687
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:1131
SpecialPage\$hookContainer
HookContainer null $hookContainer
Definition: SpecialPage.php:83
SpecialPage\getContext
getContext()
Gets the context this SpecialPage is executed in.
Definition: SpecialPage.php:788
SpecialPage\requireLogin
requireLogin( $reasonMsg='exception-nologin-text', $titleMsg='exception-nologin')
If the user is not logged in, throws UserNotLoggedIn error.
Definition: SpecialPage.php:412
SpecialPage\setLinkRenderer
setLinkRenderer(LinkRenderer $linkRenderer)
Definition: SpecialPage.php:1065
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:674
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:358
SpecialPage\getRobotPolicy
getRobotPolicy()
Return the robot policy.
Definition: SpecialPage.php:923
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:632
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:248
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:1079
SpecialPage\isCached
isCached()
Is this page cached? Expensive pages are cached or disabled in miser mode.
Definition: SpecialPage.php:330
SpecialPage\getRequest
getRequest()
Get the WebRequest being used for this instance.
Definition: SpecialPage.php:804
SpecialPage\getLoginSecurityLevel
getLoginSecurityLevel()
Tells if the special page does something security-sensitive and needs extra defense against a stolen ...
Definition: SpecialPage.php:428
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:289
SpecialPage\run
run( $subPage)
Entry point.
Definition: SpecialPage.php:663
SpecialPage\execute
execute( $subPage)
Default execute method Checks user permissions.
Definition: SpecialPage.php:713
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:1052
SpecialPage\setContentLanguage
setContentLanguage(Language $contentLanguage)
Set content language.
Definition: SpecialPage.php:880
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:588
SpecialPage\getAuthManager
getAuthManager()
Definition: SpecialPage.php:544
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:570
SpecialPage\getSpecialPageFactory
getSpecialPageFactory()
Definition: SpecialPage.php:1139
SpecialPage\setContext
setContext( $context)
Sets the context this SpecialPage is executed in.
Definition: SpecialPage.php:778
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:1097
SpecialPage\getLanguageConverter
getLanguageConverter()
Shortcut to get language's converter.
Definition: SpecialPage.php:891
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:1020
SpecialPage\getContentLanguage
getContentLanguage()
Shortcut to get content language.
Definition: SpecialPage.php:864
SpecialPage\checkReadOnly
checkReadOnly()
If the wiki is currently in readonly mode, throws a ReadOnlyError.
Definition: SpecialPage.php:395
$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:67
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:733
SpecialPage\including
including( $x=null)
Whether the special page is being evaluated via transclusion.
Definition: SpecialPage.php:290
Language
Internationalisation code See https://www.mediawiki.org/wiki/Special:MyLanguage/Localisation for more...
Definition: Language.php:42
SpecialPage\newSearchPage
static newSearchPage(User $user)
Get the users preferred search page.
Definition: SpecialPage.php:103
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