MediaWiki  master
SpecialPage.php
Go to the documentation of this file.
1 <?php
31 
42 class SpecialPage implements MessageLocalizer {
47  protected $mName;
48 
50  private $mLocalName;
51 
56  protected $mRestriction;
57 
59  private $mListed;
60 
62  protected $mIncluding;
63 
65  protected $mIncludable;
66 
71  protected $mContext;
72 
75 
79  private $linkRenderer = null;
80 
82  private $hookContainer;
84  private $hookRunner;
85 
87  private $authManager = null;
88 
91 
106  public static function getTitleFor( $name, $subpage = false, $fragment = '' ) {
108  self::getTitleValueFor( $name, $subpage, $fragment )
109  );
110  }
111 
121  public static function getTitleValueFor( $name, $subpage = false, $fragment = '' ) {
122  $name = MediaWikiServices::getInstance()->getSpecialPageFactory()->
123  getLocalNameFor( $name, $subpage );
124 
125  return new TitleValue( NS_SPECIAL, $name, $fragment );
126  }
127 
135  public static function getSafeTitleFor( $name, $subpage = false ) {
136  $name = MediaWikiServices::getInstance()->getSpecialPageFactory()->
137  getLocalNameFor( $name, $subpage );
138  if ( $name ) {
139  return Title::makeTitleSafe( NS_SPECIAL, $name );
140  } else {
141  return null;
142  }
143  }
144 
164  public function __construct(
165  $name = '', $restriction = '', $listed = true,
166  $function = false, $file = '', $includable = false
167  ) {
168  $this->mName = $name;
169  $this->mRestriction = $restriction;
170  $this->mListed = $listed;
171  $this->mIncludable = $includable;
172  }
173 
178  public function getName() {
179  return $this->mName;
180  }
181 
186  public function getRestriction() {
187  return $this->mRestriction;
188  }
189 
190  // @todo FIXME: Decide which syntax to use for this, and stick to it
191 
198  public function isListed() {
199  return $this->mListed;
200  }
201 
210  public function setListed( $listed ) {
211  wfDeprecated( __METHOD__, '1.35' );
212  return wfSetVar( $this->mListed, $listed );
213  }
214 
223  public function listed( $x = null ) {
224  wfDeprecated( __METHOD__, '1.35' );
225  return wfSetVar( $this->mListed, $x );
226  }
227 
233  public function isIncludable() {
234  return $this->mIncludable;
235  }
236 
248  public function maxIncludeCacheTime() {
249  return $this->getConfig()->get( 'MiserMode' ) ? $this->getCacheTTL() : 0;
250  }
251 
256  protected function getCacheTTL() {
257  return 60 * 60;
258  }
259 
265  public function including( $x = null ) {
266  return wfSetVar( $this->mIncluding, $x );
267  }
268 
274  public function getLocalName() {
275  if ( !isset( $this->mLocalName ) ) {
276  $this->mLocalName = $this->getSpecialPageFactory()->getLocalNameFor( $this->mName );
277  }
278 
279  return $this->mLocalName;
280  }
281 
291  public function isExpensive() {
292  return false;
293  }
294 
305  public function isCached() {
306  return false;
307  }
308 
317  public function isRestricted() {
318  // DWIM: If anons can do something, then it is not restricted
319  return $this->mRestriction != '' && !MediaWikiServices::getInstance()
320  ->getPermissionManager()
321  ->groupHasPermission( '*', $this->mRestriction );
322  }
323 
333  public function userCanExecute( User $user ) {
334  return MediaWikiServices::getInstance()
335  ->getPermissionManager()
336  ->userHasRight( $user, $this->mRestriction );
337  }
338 
344  protected function displayRestrictionError() {
345  throw new PermissionsError( $this->mRestriction );
346  }
347 
356  public function checkPermissions() {
357  if ( !$this->userCanExecute( $this->getUser() ) ) {
358  $this->displayRestrictionError();
359  }
360  }
361 
369  public function checkReadOnly() {
370  if ( wfReadOnly() ) {
371  throw new ReadOnlyError;
372  }
373  }
374 
386  public function requireLogin(
387  $reasonMsg = 'exception-nologin-text', $titleMsg = 'exception-nologin'
388  ) {
389  if ( $this->getUser()->isAnon() ) {
390  throw new UserNotLoggedIn( $reasonMsg, $titleMsg );
391  }
392  }
393 
402  protected function getLoginSecurityLevel() {
403  return false;
404  }
405 
423  protected function setReauthPostData( array $data ) {
424  }
425 
451  protected function checkLoginSecurityLevel( $level = null ) {
452  $level = $level ?: $this->getName();
453  $key = 'SpecialPage:reauth:' . $this->getName();
454  $request = $this->getRequest();
455 
456  $securityStatus = $this->getAuthManager()->securitySensitiveOperationStatus( $level );
457  if ( $securityStatus === AuthManager::SEC_OK ) {
458  $uniqueId = $request->getVal( 'postUniqueId' );
459  if ( $uniqueId ) {
460  $key .= ':' . $uniqueId;
461  $session = $request->getSession();
462  $data = $session->getSecret( $key );
463  if ( $data ) {
464  $session->remove( $key );
465  $this->setReauthPostData( $data );
466  }
467  }
468  return true;
469  } elseif ( $securityStatus === AuthManager::SEC_REAUTH ) {
470  $title = self::getTitleFor( 'Userlogin' );
471  $queryParams = $request->getQueryValues();
472 
473  if ( $request->wasPosted() ) {
474  $data = array_diff_assoc( $request->getValues(), $request->getQueryValues() );
475  if ( $data ) {
476  // unique ID in case the same special page is open in multiple browser tabs
477  $uniqueId = MWCryptRand::generateHex( 6 );
478  $key .= ':' . $uniqueId;
479  $queryParams['postUniqueId'] = $uniqueId;
480  $session = $request->getSession();
481  $session->persist(); // Just in case
482  $session->setSecret( $key, $data );
483  }
484  }
485 
486  $query = [
487  'returnto' => $this->getFullTitle()->getPrefixedDBkey(),
488  'returntoquery' => wfArrayToCgi( array_diff_key( $queryParams, [ 'title' => true ] ) ),
489  'force' => $level,
490  ];
491  $url = $title->getFullURL( $query, false, PROTO_HTTPS );
492 
493  $this->getOutput()->redirect( $url );
494  return false;
495  }
496 
497  $titleMessage = wfMessage( 'specialpage-securitylevel-not-allowed-title' );
498  $errorMessage = wfMessage( 'specialpage-securitylevel-not-allowed' );
499  throw new ErrorPageError( $titleMessage, $errorMessage );
500  }
501 
508  final protected function setAuthManager( AuthManager $authManager ) {
509  $this->authManager = $authManager;
510  }
511 
518  final protected function getAuthManager(): AuthManager {
519  if ( $this->authManager === null ) {
520  // Fallback if not provided
521  // TODO Change to wfWarn in a future release
522  $this->authManager = MediaWikiServices::getInstance()->getAuthManager();
523  }
524  return $this->authManager;
525  }
526 
544  public function prefixSearchSubpages( $search, $limit, $offset ) {
545  $subpages = $this->getSubpagesForPrefixSearch();
546  if ( !$subpages ) {
547  return [];
548  }
549 
550  return self::prefixSearchArray( $search, $limit, $subpages, $offset );
551  }
552 
562  protected function getSubpagesForPrefixSearch() {
563  return [];
564  }
565 
575  protected function prefixSearchString( $search, $limit, $offset, SearchEngineFactory $searchEngineFactory = null ) {
576  $title = Title::newFromText( $search );
577  if ( !$title || !$title->canExist() ) {
578  // No prefix suggestion in special and media namespace
579  return [];
580  }
581 
582  $searchEngine = $searchEngineFactory
583  ? $searchEngineFactory->create()
584  // Fallback if not provided
585  // TODO Change to wfWarn in a future release
586  : MediaWikiServices::getInstance()->newSearchEngine();
587  $searchEngine->setLimitOffset( $limit, $offset );
588  $searchEngine->setNamespaces( [] );
589  $result = $searchEngine->defaultPrefixSearch( $search );
590  return array_map( function ( Title $t ) {
591  return $t->getPrefixedText();
592  }, $result );
593  }
594 
606  protected static function prefixSearchArray( $search, $limit, array $subpages, $offset ) {
607  $escaped = preg_quote( $search, '/' );
608  return array_slice( preg_grep( "/^$escaped/i",
609  array_slice( $subpages, $offset ) ), 0, $limit );
610  }
611 
616  protected function setHeaders() {
617  $out = $this->getOutput();
618  $out->setArticleRelated( false );
619  $out->setRobotPolicy( $this->getRobotPolicy() );
620  $out->setPageTitle( $this->getDescription() );
621  if ( $this->getConfig()->get( 'UseMediaWikiUIEverywhere' ) ) {
622  $out->addModuleStyles( [
623  'mediawiki.ui.input',
624  'mediawiki.ui.radio',
625  'mediawiki.ui.checkbox',
626  ] );
627  }
628  }
629 
637  final public function run( $subPage ) {
638  if ( !$this->getHookRunner()->onSpecialPageBeforeExecute( $this, $subPage ) ) {
639  return;
640  }
641 
642  if ( $this->beforeExecute( $subPage ) === false ) {
643  return;
644  }
645  $this->execute( $subPage );
646  $this->afterExecute( $subPage );
647 
648  $this->getHookRunner()->onSpecialPageAfterExecute( $this, $subPage );
649  }
650 
661  protected function beforeExecute( $subPage ) {
662  // No-op
663  }
664 
673  protected function afterExecute( $subPage ) {
674  // No-op
675  }
676 
687  public function execute( $subPage ) {
688  $this->setHeaders();
689  $this->checkPermissions();
690  $securityLevel = $this->getLoginSecurityLevel();
691  if ( $securityLevel !== false && !$this->checkLoginSecurityLevel( $securityLevel ) ) {
692  return;
693  }
694  $this->outputHeader();
695  }
696 
707  protected function outputHeader( $summaryMessageKey = '' ) {
708  if ( $summaryMessageKey == '' ) {
709  $msg = $this->getContentLanguage()->lc( $this->getName() ) .
710  '-summary';
711  } else {
712  $msg = $summaryMessageKey;
713  }
714  if ( !$this->msg( $msg )->isDisabled() && !$this->including() ) {
715  $this->getOutput()->wrapWikiMsg(
716  "<div class='mw-specialpage-summary'>\n$1\n</div>", $msg );
717  }
718  }
719 
731  public function getDescription() {
732  return $this->msg( strtolower( $this->mName ) )->text();
733  }
734 
742  public function getPageTitle( $subpage = false ) {
743  return self::getTitleFor( $this->mName, $subpage );
744  }
745 
752  public function setContext( $context ) {
753  $this->mContext = $context;
754  }
755 
762  public function getContext() {
763  if ( !( $this->mContext instanceof IContextSource ) ) {
764  wfDebug( __METHOD__ . " called and \$mContext is null. " .
765  "Using RequestContext::getMain(); for sanity" );
766 
767  $this->mContext = RequestContext::getMain();
768  }
769  return $this->mContext;
770  }
771 
778  public function getRequest() {
779  return $this->getContext()->getRequest();
780  }
781 
788  public function getOutput() {
789  return $this->getContext()->getOutput();
790  }
791 
798  public function getUser() {
799  return $this->getContext()->getUser();
800  }
801 
808  public function getSkin() {
809  return $this->getContext()->getSkin();
810  }
811 
818  public function getLanguage() {
819  return $this->getContext()->getLanguage();
820  }
821 
828  final public function getContentLanguage(): Language {
829  if ( $this->contentLanguage === null ) {
830  // Fallback if not provided
831  // TODO Change to wfWarn in a future release
832  $this->contentLanguage = MediaWikiServices::getInstance()->getContentLanguage();
833  }
834  return $this->contentLanguage;
835  }
836 
844  final public function setContentLanguage( Language $contentLanguage ) {
845  $this->contentLanguage = $contentLanguage;
846  }
847 
855  protected function getLanguageConverter(): ILanguageConverter {
856  wfDeprecated( __METHOD__, '1.36' );
857  return MediaWikiServices::getInstance()->getLanguageConverterFactory()
858  ->getLanguageConverter();
859  }
860 
866  public function getConfig() {
867  return $this->getContext()->getConfig();
868  }
869 
876  public function getFullTitle() {
877  return $this->getContext()->getTitle();
878  }
879 
887  protected function getRobotPolicy() {
888  return 'noindex,nofollow';
889  }
890 
900  public function msg( $key, ...$params ) {
901  $message = $this->getContext()->msg( $key, ...$params );
902  // RequestContext passes context to wfMessage, and the language is set from
903  // the context, but setting the language for Message class removes the
904  // interface message status, which breaks for example usernameless gender
905  // invocations. Restore the flag when not including special page in content.
906  if ( $this->including() ) {
907  $message->setInterfaceMessageFlag( false );
908  }
909 
910  return $message;
911  }
912 
918  protected function addFeedLinks( $params ) {
919  $feedTemplate = wfScript( 'api' );
920 
921  foreach ( $this->getConfig()->get( 'FeedClasses' ) as $format => $class ) {
922  $theseParams = $params + [ 'feedformat' => $format ];
923  $url = wfAppendQuery( $feedTemplate, $theseParams );
924  $this->getOutput()->addFeedLink( $format, $url );
925  }
926  }
927 
936  public function addHelpLink( $to, $overrideBaseUrl = false ) {
937  if ( $this->including() ) {
938  return;
939  }
940 
941  $msg = $this->msg( $this->getContentLanguage()->lc( $this->getName() ) . '-helppage' );
942 
943  if ( !$msg->isDisabled() ) {
944  $title = Title::newFromText( $msg->plain() );
945  if ( $title instanceof Title ) {
946  $this->getOutput()->addHelpLink( $title->getLocalURL(), true );
947  }
948  } else {
949  $this->getOutput()->addHelpLink( $to, $overrideBaseUrl );
950  }
951  }
952 
961  public function getFinalGroupName() {
962  $name = $this->getName();
963 
964  // Allow overriding the group from the wiki side
965  $msg = $this->msg( 'specialpages-specialpagegroup-' . strtolower( $name ) )->inContentLanguage();
966  if ( !$msg->isBlank() ) {
967  $group = $msg->text();
968  } else {
969  // Than use the group from this object
970  $group = $this->getGroupName();
971  }
972 
973  return $group;
974  }
975 
984  public function doesWrites() {
985  return false;
986  }
987 
998  protected function getGroupName() {
999  return 'other';
1000  }
1001 
1006  protected function useTransactionalTimeLimit() {
1007  if ( $this->getRequest()->wasPosted() ) {
1009  }
1010  }
1011 
1016  public function getLinkRenderer(): LinkRenderer {
1017  if ( $this->linkRenderer === null ) {
1018  // TODO Inject the service
1019  $this->linkRenderer = MediaWikiServices::getInstance()->getLinkRendererFactory()
1020  ->createForUser( $this->getUser() );
1021  }
1022  return $this->linkRenderer;
1023  }
1024 
1030  $this->linkRenderer = $linkRenderer;
1031  }
1032 
1043  protected function buildPrevNextNavigation(
1044  $offset,
1045  $limit,
1046  array $query = [],
1047  $atend = false,
1048  $subpage = false
1049  ) {
1050  $title = $this->getPageTitle( $subpage );
1051  $prevNext = new PrevNextNavigationRenderer( $this );
1052 
1053  return $prevNext->buildPrevNextNavigation( $title, $offset, $limit, $query, $atend );
1054  }
1055 
1062  $this->hookContainer = $hookContainer;
1063  $this->hookRunner = new HookRunner( $hookContainer );
1064  }
1065 
1070  protected function getHookContainer() {
1071  if ( !$this->hookContainer ) {
1072  $this->hookContainer = MediaWikiServices::getInstance()->getHookContainer();
1073  }
1074  return $this->hookContainer;
1075  }
1076 
1083  protected function getHookRunner() {
1084  if ( !$this->hookRunner ) {
1085  $this->hookRunner = new HookRunner( $this->getHookContainer() );
1086  }
1087  return $this->hookRunner;
1088  }
1089 
1096  $this->specialPageFactory = $specialPageFactory;
1097  }
1098 
1103  final protected function getSpecialPageFactory(): SpecialPageFactory {
1104  if ( !$this->specialPageFactory ) {
1105  // Fallback if not provided
1106  // TODO Change to wfWarn in a future release
1107  $this->specialPageFactory = MediaWikiServices::getInstance()->getSpecialPageFactory();
1108  }
1110  }
1111 }
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:79
SpecialPage\getPageTitle
getPageTitle( $subpage=false)
Get a self-referential title object.
Definition: SpecialPage.php:742
SpecialPage\getFinalGroupName
getFinalGroupName()
Get the group that the special page belongs in on Special:SpecialPage Use this method,...
Definition: SpecialPage.php:961
SpecialPage\$mIncludable
bool $mIncludable
Whether the special page can be included in an article.
Definition: SpecialPage.php:65
SpecialPage\msg
msg( $key,... $params)
Wrapper around wfMessage that sets the current context.
Definition: SpecialPage.php:900
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:328
SpecialPage\$specialPageFactory
SpecialPageFactory $specialPageFactory
Definition: SpecialPage.php:90
SpecialPage\getOutput
getOutput()
Get the OutputPage being used for this instance.
Definition: SpecialPage.php:788
SpecialPage\$mRestriction
string $mRestriction
Minimum user level required to access this page, or "" for anyone.
Definition: SpecialPage.php:56
SpecialPage\isExpensive
isExpensive()
Is this page expensive (for some definition of expensive)? Expensive pages are disabled or cached in ...
Definition: SpecialPage.php:291
MediaWiki\MediaWikiServices
MediaWikiServices is the service locator for the application scope of MediaWiki.
Definition: MediaWikiServices.php:165
SpecialPage\maxIncludeCacheTime
maxIncludeCacheTime()
How long to cache page when it is being included.
Definition: SpecialPage.php:248
SpecialPage\getGroupName
getGroupName()
Under which header this special page is listed in Special:SpecialPages See messages 'specialpages-gro...
Definition: SpecialPage.php:998
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:1550
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:356
SpecialPage\setReauthPostData
setReauthPostData(array $data)
Record preserved POST data after a reauthentication.
Definition: SpecialPage.php:423
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:164
SpecialPage\displayRestrictionError
displayRestrictionError()
Output an error message telling the user what access level they have to have Stable to override.
Definition: SpecialPage.php:344
SpecialPage\setListed
setListed( $listed)
Set whether this page is listed in Special:Specialpages, at run-time.
Definition: SpecialPage.php:210
$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:1126
SpecialPage\getLocalName
getLocalName()
Get the localised name of the special page Stable to override.
Definition: SpecialPage.php:274
wfMessage
wfMessage( $key,... $params)
This is the function for getting translated interface messages.
Definition: GlobalFunctions.php:1220
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:106
SpecialPage\getHookContainer
getHookContainer()
Definition: SpecialPage.php:1070
SpecialPage\$mContext
IContextSource $mContext
Current request context.
Definition: SpecialPage.php:71
SpecialPage\getSkin
getSkin()
Shortcut to get the skin being used for this instance.
Definition: SpecialPage.php:808
SpecialPage\useTransactionalTimeLimit
useTransactionalTimeLimit()
Call wfTransactionalTimeLimit() if this request was POSTed.
Definition: SpecialPage.php:1006
PermissionsError
Show an error when a user tries to do something they do not have the necessary permissions for.
Definition: PermissionsError.php:31
SpecialPage\getLanguage
getLanguage()
Shortcut to get user's language.
Definition: SpecialPage.php:818
SpecialPage\getName
getName()
Get the name of this Special Page.
Definition: SpecialPage.php:178
SpecialPage\isListed
isListed()
Whether this special page is listed in Special:SpecialPages Stable to override.
Definition: SpecialPage.php:198
SpecialPage\$authManager
AuthManager null $authManager
Definition: SpecialPage.php:87
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:186
SpecialPage\prefixSearchString
prefixSearchString( $search, $limit, $offset, SearchEngineFactory $searchEngineFactory=null)
Perform a regular substring search for prefixSearchSubpages.
Definition: SpecialPage.php:575
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:438
SpecialPage\getSafeTitleFor
static getSafeTitleFor( $name, $subpage=false)
Get a localised Title object for a page name with a possibly unvalidated subpage.
Definition: SpecialPage.php:135
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:731
NS_SPECIAL
const NS_SPECIAL
Definition: Defines.php:58
SpecialPage\addHelpLink
addHelpLink( $to, $overrideBaseUrl=false)
Adds help link with an icon via page indicators.
Definition: SpecialPage.php:936
SpecialPage\getHookRunner
getHookRunner()
Definition: SpecialPage.php:1083
SpecialPage\getConfig
getConfig()
Shortcut to get main config object.
Definition: SpecialPage.php:866
SpecialPage\$mIncluding
bool $mIncluding
Whether or not this special page is being included from an article.
Definition: SpecialPage.php:62
SpecialPage\addFeedLinks
addFeedLinks( $params)
Adds RSS/atom links.
Definition: SpecialPage.php:918
wfDeprecated
wfDeprecated( $function, $version=false, $component=false, $callerOffset=2)
Logs a warning that $function is deprecated.
Definition: GlobalFunctions.php:1027
SpecialPage\$contentLanguage
Language null $contentLanguage
Definition: SpecialPage.php:74
SpecialPage\getCacheTTL
getCacheTTL()
Stable to override.
Definition: SpecialPage.php:256
wfScript
wfScript( $script='index')
Get the path to a specified script file, respecting file extensions; this is a wrapper around $wgScri...
Definition: GlobalFunctions.php:2515
SpecialPage\checkLoginSecurityLevel
checkLoginSecurityLevel( $level=null)
Verifies that the user meets the security level, possibly reauthenticating them in the process.
Definition: SpecialPage.php:451
SpecialPage\getTitleValueFor
static getTitleValueFor( $name, $subpage=false, $fragment='')
Get a localised TitleValue object for a specified special page name.
Definition: SpecialPage.php:121
wfTransactionalTimeLimit
wfTransactionalTimeLimit()
Set PHP's time limit to the larger of php.ini or $wgTransactionalTimeLimit.
Definition: GlobalFunctions.php:2623
SpecialPage\getFullTitle
getFullTitle()
Return the full title, including $par.
Definition: SpecialPage.php:876
SpecialPage\isRestricted
isRestricted()
Can be overridden by subclasses with more complicated permissions schemes.
Definition: SpecialPage.php:317
SpecialPage\setAuthManager
setAuthManager(AuthManager $authManager)
Set the injected AuthManager from the special page constructor.
Definition: SpecialPage.php:508
$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:616
SpecialPage\getUser
getUser()
Shortcut to get the User executing this instance.
Definition: SpecialPage.php:798
SpecialPage\isIncludable
isIncludable()
Whether it's allowed to transclude the special page via {{Special:Foo/params}} Stable to override.
Definition: SpecialPage.php:233
SpecialPage\afterExecute
afterExecute( $subPage)
Gets called after.
Definition: SpecialPage.php:673
SpecialPage\beforeExecute
beforeExecute( $subPage)
Gets called before.
Definition: SpecialPage.php:661
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:910
SpecialPage\setSpecialPageFactory
setSpecialPageFactory(SpecialPageFactory $specialPageFactory)
Definition: SpecialPage.php:1095
PROTO_HTTPS
const PROTO_HTTPS
Definition: Defines.php:209
SpecialPage\$hookContainer
HookContainer null $hookContainer
Definition: SpecialPage.php:82
SpecialPage\getContext
getContext()
Gets the context this SpecialPage is executed in.
Definition: SpecialPage.php:762
SpecialPage\requireLogin
requireLogin( $reasonMsg='exception-nologin-text', $titleMsg='exception-nologin')
If the user is not logged in, throws UserNotLoggedIn error.
Definition: SpecialPage.php:386
SpecialPage\setLinkRenderer
setLinkRenderer(LinkRenderer $linkRenderer)
Definition: SpecialPage.php:1029
Title\makeTitleSafe
static makeTitleSafe( $ns, $title, $fragment='', $interwiki='')
Create a new Title from a namespace index and a DB key.
Definition: Title.php:617
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:333
SpecialPage\getRobotPolicy
getRobotPolicy()
Return the robot policy.
Definition: SpecialPage.php:887
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:606
SpecialPage
Parent class for all special pages.
Definition: SpecialPage.php:42
SpecialPage\listed
listed( $x=null)
Get or set whether this special page is listed in Special:SpecialPages.
Definition: SpecialPage.php:223
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:1043
SpecialPage\isCached
isCached()
Is this page cached? Expensive pages are cached or disabled in miser mode.
Definition: SpecialPage.php:305
SpecialPage\getRequest
getRequest()
Get the WebRequest being used for this instance.
Definition: SpecialPage.php:778
SpecialPage\getLoginSecurityLevel
getLoginSecurityLevel()
Tells if the special page does something security-sensitive and needs extra defense against a stolen ...
Definition: SpecialPage.php:402
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:454
Title\newFromLinkTarget
static newFromLinkTarget(LinkTarget $linkTarget, $forceClone='')
Returns a Title given a LinkTarget.
Definition: Title.php:280
SpecialPage\run
run( $subPage)
Entry point.
Definition: SpecialPage.php:637
SpecialPage\execute
execute( $subPage)
Default execute method Checks user permissions.
Definition: SpecialPage.php:687
MediaWiki\Auth\AuthManager
This serves as the entry point to the authentication system.
Definition: AuthManager.php:92
IContextSource
Interface for objects which can provide a MediaWiki context on request.
Definition: IContextSource.php:55
SpecialPage\getLinkRenderer
getLinkRenderer()
Definition: SpecialPage.php:1016
SpecialPage\setContentLanguage
setContentLanguage(Language $contentLanguage)
Set content language.
Definition: SpecialPage.php:844
Title
Represents a title within MediaWiki.
Definition: Title.php:41
SpecialPage\$hookRunner
HookRunner null $hookRunner
Definition: SpecialPage.php:84
SpecialPage\getSubpagesForPrefixSearch
getSubpagesForPrefixSearch()
Return an array of subpages that this special page will accept for prefix searches.
Definition: SpecialPage.php:562
SpecialPage\getAuthManager
getAuthManager()
Definition: SpecialPage.php:518
SpecialPage\$mLocalName
string $mLocalName
The local name of this special page.
Definition: SpecialPage.php:50
SpecialPage\prefixSearchSubpages
prefixSearchSubpages( $search, $limit, $offset)
Return an array of subpages beginning with $search that this special page will accept.
Definition: SpecialPage.php:544
SpecialPage\getSpecialPageFactory
getSpecialPageFactory()
Definition: SpecialPage.php:1103
SpecialPage\setContext
setContext( $context)
Sets the context this SpecialPage is executed in.
Definition: SpecialPage.php:752
SpecialPage\$mName
string $mName
The canonical name of this special page Also used for the default.
Definition: SpecialPage.php:47
MediaWiki\HookContainer\HookContainer
HookContainer class.
Definition: HookContainer.php:45
SpecialPage\setHookContainer
setHookContainer(HookContainer $hookContainer)
Definition: SpecialPage.php:1061
SpecialPage\getLanguageConverter
getLanguageConverter()
Shortcut to get language's converter.
Definition: SpecialPage.php:855
MediaWiki\HookContainer\HookRunner
This class provides an implementation of the core hook interfaces, forwarding hook calls to HookConta...
Definition: HookRunner.php:567
SpecialPage\doesWrites
doesWrites()
Indicates whether this special page may perform database writes.
Definition: SpecialPage.php:984
SpecialPage\getContentLanguage
getContentLanguage()
Shortcut to get content language.
Definition: SpecialPage.php:828
SpecialPage\checkReadOnly
checkReadOnly()
If the wiki is currently in readonly mode, throws a ReadOnlyError.
Definition: SpecialPage.php:369
$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:59
User
The User object encapsulates all of the user-specific settings (user_id, name, rights,...
Definition: User.php:56
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:707
SpecialPage\including
including( $x=null)
Whether the special page is being evaluated via transclusion.
Definition: SpecialPage.php:265
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:39
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:346