MediaWiki  master
SpecialPageFactory.php
Go to the documentation of this file.
1 <?php
26 
27 use Hooks;
28 use IContextSource;
29 use Language;
32 use Profiler;
33 use RequestContext;
34 use SpecialPage;
35 use Title;
36 use User;
37 use Wikimedia\ObjectFactory;
38 
68  private const CORE_LIST = [
69  // Maintenance Reports
70  'BrokenRedirects' => \SpecialBrokenRedirects::class,
71  'Deadendpages' => \SpecialDeadendPages::class,
72  'DoubleRedirects' => \SpecialDoubleRedirects::class,
73  'Longpages' => \SpecialLongPages::class,
74  'Ancientpages' => \SpecialAncientPages::class,
75  'Lonelypages' => \SpecialLonelyPages::class,
76  'Fewestrevisions' => \SpecialFewestRevisions::class,
77  'Withoutinterwiki' => \SpecialWithoutInterwiki::class,
78  'Protectedpages' => \SpecialProtectedpages::class,
79  'Protectedtitles' => \SpecialProtectedtitles::class,
80  'Shortpages' => \SpecialShortPages::class,
81  'Uncategorizedcategories' => \SpecialUncategorizedCategories::class,
82  'Uncategorizedimages' => \SpecialUncategorizedImages::class,
83  'Uncategorizedpages' => \SpecialUncategorizedPages::class,
84  'Uncategorizedtemplates' => \SpecialUncategorizedTemplates::class,
85  'Unusedcategories' => \SpecialUnusedCategories::class,
86  'Unusedimages' => \SpecialUnusedImages::class,
87  'Unusedtemplates' => \SpecialUnusedTemplates::class,
88  'Unwatchedpages' => \SpecialUnwatchedPages::class,
89  'Wantedcategories' => \SpecialWantedCategories::class,
90  'Wantedfiles' => \WantedFilesPage::class,
91  'Wantedpages' => \WantedPagesPage::class,
92  'Wantedtemplates' => \SpecialWantedTemplates::class,
93 
94  // List of pages
95  'Allpages' => \SpecialAllPages::class,
96  'Prefixindex' => \SpecialPrefixindex::class,
97  'Categories' => \SpecialCategories::class,
98  'Listredirects' => \SpecialListRedirects::class,
99  'PagesWithProp' => \SpecialPagesWithProp::class,
100  'TrackingCategories' => \SpecialTrackingCategories::class,
101 
102  // Authentication
103  'Userlogin' => \SpecialUserLogin::class,
104  'Userlogout' => \SpecialUserLogout::class,
105  'CreateAccount' => \SpecialCreateAccount::class,
106  'LinkAccounts' => \SpecialLinkAccounts::class,
107  'UnlinkAccounts' => \SpecialUnlinkAccounts::class,
108  'ChangeCredentials' => \SpecialChangeCredentials::class,
109  'RemoveCredentials' => \SpecialRemoveCredentials::class,
110 
111  // Users and rights
112  'Activeusers' => \SpecialActiveUsers::class,
113  'Block' => \SpecialBlock::class,
114  'Unblock' => \SpecialUnblock::class,
115  'BlockList' => \SpecialBlockList::class,
116  'AutoblockList' => \SpecialAutoblockList::class,
117  'ChangePassword' => \SpecialChangePassword::class,
118  'BotPasswords' => \SpecialBotPasswords::class,
119  'PasswordReset' => \SpecialPasswordReset::class,
120  'DeletedContributions' => \SpecialDeletedContributions::class,
121  'Preferences' => \SpecialPreferences::class,
122  'ResetTokens' => \SpecialResetTokens::class,
123  'Contributions' => \SpecialContributions::class,
124  'Listgrouprights' => \SpecialListGroupRights::class,
125  'Listgrants' => \SpecialListGrants::class,
126  'Listusers' => \SpecialListUsers::class,
127  'Listadmins' => \SpecialListAdmins::class,
128  'Listbots' => \SpecialListBots::class,
129  'Userrights' => \UserrightsPage::class,
130  'EditWatchlist' => \SpecialEditWatchlist::class,
131  'PasswordPolicies' => \SpecialPasswordPolicies::class,
132 
133  // Recent changes and logs
134  'Newimages' => \SpecialNewFiles::class,
135  'Log' => \SpecialLog::class,
136  'Watchlist' => \SpecialWatchlist::class,
137  'Newpages' => \SpecialNewpages::class,
138  'Recentchanges' => \SpecialRecentChanges::class,
139  'Recentchangeslinked' => \SpecialRecentChangesLinked::class,
140  'Tags' => \SpecialTags::class,
141 
142  // Media reports and uploads
143  'Listfiles' => \SpecialListFiles::class,
144  'Filepath' => \SpecialFilepath::class,
145  'MediaStatistics' => \SpecialMediaStatistics::class,
146  'MIMEsearch' => \SpecialMIMESearch::class,
147  'FileDuplicateSearch' => \SpecialFileDuplicateSearch::class,
148  'Upload' => \SpecialUpload::class,
149  'UploadStash' => \SpecialUploadStash::class,
150  'ListDuplicatedFiles' => \SpecialListDuplicatedFiles::class,
151 
152  // Data and tools
153  'ApiSandbox' => \SpecialApiSandbox::class,
154  'Statistics' => \SpecialStatistics::class,
155  'Allmessages' => \SpecialAllMessages::class,
156  'Version' => \SpecialVersion::class,
157  'Lockdb' => \SpecialLockdb::class,
158  'Unlockdb' => \SpecialUnlockdb::class,
159 
160  // Redirecting special pages
161  'LinkSearch' => \SpecialLinkSearch::class,
162  'Randompage' => \RandomPage::class,
163  'RandomInCategory' => \SpecialRandomInCategory::class,
164  'Randomredirect' => \SpecialRandomredirect::class,
165  'Randomrootpage' => \SpecialRandomrootpage::class,
166  'GoToInterwiki' => \SpecialGoToInterwiki::class,
167 
168  // High use pages
169  'Mostlinkedcategories' => \SpecialMostLinkedCategories::class,
170  'Mostimages' => \MostimagesPage::class,
171  'Mostinterwikis' => \SpecialMostInterwikis::class,
172  'Mostlinked' => \SpecialMostLinked::class,
173  'Mostlinkedtemplates' => \SpecialMostLinkedTemplates::class,
174  'Mostcategories' => \SpecialMostCategories::class,
175  'Mostrevisions' => \SpecialMostRevisions::class,
176 
177  // Page tools
178  'ComparePages' => \SpecialComparePages::class,
179  'Export' => \SpecialExport::class,
180  'Import' => \SpecialImport::class,
181  'Undelete' => \SpecialUndelete::class,
182  'Whatlinkshere' => \SpecialWhatLinksHere::class,
183  'MergeHistory' => \SpecialMergeHistory::class,
184  'ExpandTemplates' => \SpecialExpandTemplates::class,
185 
186  // Other
187  'Booksources' => \SpecialBookSources::class,
188 
189  // Unlisted / redirects
190  'ApiHelp' => \SpecialApiHelp::class,
191  'Blankpage' => \SpecialBlankpage::class,
192  'Diff' => \SpecialDiff::class,
193  'EditPage' => \SpecialEditPage::class,
194  'EditTags' => [
195  'class' => \SpecialEditTags::class,
196  'services' => [
197  'PermissionManager',
198  ],
199  ],
200  'Emailuser' => \SpecialEmailUser::class,
201  'Movepage' => \MovePageForm::class,
202  'Mycontributions' => \SpecialMycontributions::class,
203  'MyLanguage' => \SpecialMyLanguage::class,
204  'Mypage' => \SpecialMypage::class,
205  'Mytalk' => \SpecialMytalk::class,
206  'PageHistory' => \SpecialPageHistory::class,
207  'PageInfo' => \SpecialPageInfo::class,
208  'Purge' => \SpecialPurge::class,
209  'Myuploads' => \SpecialMyuploads::class,
210  'AllMyUploads' => \SpecialAllMyUploads::class,
211  'NewSection' => \SpecialNewSection::class,
212  'PermanentLink' => \SpecialPermanentLink::class,
213  'Redirect' => \SpecialRedirect::class,
214  'Revisiondelete' => [
215  'class' => \SpecialRevisionDelete::class,
216  'services' => [
217  'PermissionManager',
218  ],
219  ],
220  'RunJobs' => \SpecialRunJobs::class,
221  'Specialpages' => \SpecialSpecialpages::class,
222  'PageData' => \SpecialPageData::class,
223  ];
224 
226  private $list;
227 
229  private $aliases;
230 
232  private $options;
233 
235  private $contLang;
236 
238  private $objectFactory;
239 
244  public const CONSTRUCTOR_OPTIONS = [
245  'ContentHandlerUseDB',
246  'DisableInternalSearch',
247  'EmailAuthentication',
248  'EnableEmail',
249  'EnableJavaScriptTest',
250  'EnableSpecialMute',
251  'PageLanguageUseDB',
252  'SpecialPages',
253  ];
254 
260  public function __construct(
263  ObjectFactory $objectFactory
264  ) {
265  $options->assertRequiredOptions( self::CONSTRUCTOR_OPTIONS );
266  $this->options = $options;
267  $this->contLang = $contLang;
268  $this->objectFactory = $objectFactory;
269  }
270 
277  public function getNames() : array {
278  return array_keys( $this->getPageList() );
279  }
280 
286  private function getPageList() : array {
287  if ( !is_array( $this->list ) ) {
288  $this->list = self::CORE_LIST;
289 
290  if ( !$this->options->get( 'DisableInternalSearch' ) ) {
291  $this->list['Search'] = \SpecialSearch::class;
292  }
293 
294  if ( $this->options->get( 'EmailAuthentication' ) ) {
295  $this->list['Confirmemail'] = \SpecialConfirmEmail::class;
296  $this->list['Invalidateemail'] = \SpecialEmailInvalidate::class;
297  }
298 
299  if ( $this->options->get( 'EnableEmail' ) ) {
300  $this->list['ChangeEmail'] = \SpecialChangeEmail::class;
301  }
302 
303  if ( $this->options->get( 'EnableJavaScriptTest' ) ) {
304  $this->list['JavaScriptTest'] = \SpecialJavaScriptTest::class;
305  }
306 
307  if ( $this->options->get( 'EnableSpecialMute' ) ) {
308  $this->list['Mute'] = \SpecialMute::class;
309  }
310 
311  if ( $this->options->get( 'PageLanguageUseDB' ) ) {
312  $this->list['PageLanguage'] = \SpecialPageLanguage::class;
313  }
314 
315  if ( $this->options->get( 'ContentHandlerUseDB' ) ) {
316  $this->list['ChangeContentModel'] = \SpecialChangeContentModel::class;
317  }
318 
319  // Add extension special pages
320  $this->list = array_merge( $this->list, $this->options->get( 'SpecialPages' ) );
321 
322  // This hook can be used to disable unwanted core special pages
323  // or conditionally register special pages.
324  Hooks::run( 'SpecialPage_initList', [ &$this->list ] );
325 
326  }
327 
328  return $this->list;
329  }
330 
337  private function getAliasList() : array {
338  if ( is_null( $this->aliases ) ) {
339  $aliases = $this->contLang->getSpecialPageAliases();
340  $pageList = $this->getPageList();
341 
342  $this->aliases = [];
343  $keepAlias = [];
344 
345  // Force every canonical name to be an alias for itself.
346  foreach ( $pageList as $name => $stuff ) {
347  $caseFoldedAlias = $this->contLang->caseFold( $name );
348  $this->aliases[$caseFoldedAlias] = $name;
349  $keepAlias[$caseFoldedAlias] = 'canonical';
350  }
351 
352  // Check for $aliases being an array since Language::getSpecialPageAliases can return null
353  if ( is_array( $aliases ) ) {
354  foreach ( $aliases as $realName => $aliasList ) {
355  $aliasList = array_values( $aliasList );
356  foreach ( $aliasList as $i => $alias ) {
357  $caseFoldedAlias = $this->contLang->caseFold( $alias );
358 
359  if ( isset( $this->aliases[$caseFoldedAlias] ) &&
360  $realName === $this->aliases[$caseFoldedAlias]
361  ) {
362  // Ignore same-realName conflicts
363  continue;
364  }
365 
366  if ( !isset( $keepAlias[$caseFoldedAlias] ) ) {
367  $this->aliases[$caseFoldedAlias] = $realName;
368  if ( !$i ) {
369  $keepAlias[$caseFoldedAlias] = 'first';
370  }
371  } elseif ( !$i ) {
372  wfWarn( "First alias '$alias' for $realName conflicts with " .
373  "{$keepAlias[$caseFoldedAlias]} alias for " .
374  $this->aliases[$caseFoldedAlias]
375  );
376  }
377  }
378  }
379  }
380  }
381 
382  return $this->aliases;
383  }
384 
393  public function resolveAlias( $alias ) {
394  $bits = explode( '/', $alias, 2 );
395 
396  $caseFoldedAlias = $this->contLang->caseFold( $bits[0] );
397  $caseFoldedAlias = str_replace( ' ', '_', $caseFoldedAlias );
398  $aliases = $this->getAliasList();
399  if ( !isset( $aliases[$caseFoldedAlias] ) ) {
400  return [ null, null ];
401  }
402  $name = $aliases[$caseFoldedAlias];
403  $par = $bits[1] ?? null; // T4087
404 
405  return [ $name, $par ];
406  }
407 
414  public function exists( $name ) {
415  list( $title, /*...*/ ) = $this->resolveAlias( $name );
416 
417  $specialPageList = $this->getPageList();
418  return isset( $specialPageList[$title] );
419  }
420 
427  public function getPage( $name ) {
428  list( $realName, /*...*/ ) = $this->resolveAlias( $name );
429 
430  $specialPageList = $this->getPageList();
431 
432  if ( isset( $specialPageList[$realName] ) ) {
433  $rec = $specialPageList[$realName];
434 
435  if ( $rec instanceof SpecialPage ) {
436  wfDeprecated(
437  "a SpecialPage instance (for $realName) in " .
438  '$wgSpecialPages or from the SpecialPage_initList hook',
439  '1.34'
440  );
441 
442  $page = $rec; // XXX: we should deep clone here
443  } elseif ( is_array( $rec ) || is_string( $rec ) || is_callable( $rec ) ) {
444  $page = $this->objectFactory->createObject(
445  $rec,
446  [
447  'allowClassName' => true,
448  'allowCallable' => true
449  ]
450  );
451  } else {
452  $page = null;
453  }
454 
455  if ( $page instanceof SpecialPage ) {
456  return $page;
457  }
458 
459  // It's not a classname, nor a callback, nor a legacy constructor array,
460  // nor a special page object. Give up.
461  wfLogWarning( "Cannot instantiate special page $realName: bad spec!" );
462  }
463 
464  return null;
465  }
466 
475  public function getUsablePages( User $user ) : array {
476  $pages = [];
477  foreach ( $this->getPageList() as $name => $rec ) {
478  $page = $this->getPage( $name );
479  if ( $page ) { // not null
480  $page->setContext( RequestContext::getMain() );
481  if ( $page->isListed()
482  && ( !$page->isRestricted() || $page->userCanExecute( $user ) )
483  ) {
484  $pages[$name] = $page;
485  }
486  }
487  }
488 
489  return $pages;
490  }
491 
497  public function getRegularPages() : array {
498  $pages = [];
499  foreach ( $this->getPageList() as $name => $rec ) {
500  $page = $this->getPage( $name );
501  if ( $page && $page->isListed() && !$page->isRestricted() ) {
502  $pages[$name] = $page;
503  }
504  }
505 
506  return $pages;
507  }
508 
516  public function getRestrictedPages( User $user ) : array {
517  $pages = [];
518  foreach ( $this->getPageList() as $name => $rec ) {
519  $page = $this->getPage( $name );
520  if ( $page
521  && $page->isListed()
522  && $page->isRestricted()
523  && $page->userCanExecute( $user )
524  ) {
525  $pages[$name] = $page;
526  }
527  }
528 
529  return $pages;
530  }
531 
547  public function executePath( Title &$title, IContextSource &$context, $including = false,
548  LinkRenderer $linkRenderer = null
549  ) {
550  // @todo FIXME: Redirects broken due to this call
551  $bits = explode( '/', $title->getDBkey(), 2 );
552  $name = $bits[0];
553  $par = $bits[1] ?? null; // T4087
554 
555  $page = $this->getPage( $name );
556  if ( !$page ) {
557  $context->getOutput()->setArticleRelated( false );
558  $context->getOutput()->setRobotPolicy( 'noindex,nofollow' );
559 
560  global $wgSend404Code;
561  if ( $wgSend404Code ) {
562  $context->getOutput()->setStatusCode( 404 );
563  }
564 
565  $context->getOutput()->showErrorPage( 'nosuchspecialpage', 'nospecialpagetext' );
566 
567  return false;
568  }
569 
570  if ( !$including ) {
571  // Narrow DB query expectations for this HTTP request
572  $trxLimits = $context->getConfig()->get( 'TrxProfilerLimits' );
573  $trxProfiler = Profiler::instance()->getTransactionProfiler();
574  if ( $context->getRequest()->wasPosted() && !$page->doesWrites() ) {
575  $trxProfiler->setExpectations( $trxLimits['POST-nonwrite'], __METHOD__ );
576  $context->getRequest()->markAsSafeRequest();
577  }
578  }
579 
580  // Page exists, set the context
581  $page->setContext( $context );
582 
583  if ( !$including ) {
584  // Redirect to canonical alias for GET commands
585  // Not for POST, we'd lose the post data, so it's best to just distribute
586  // the request. Such POST requests are possible for old extensions that
587  // generate self-links without being aware that their default name has
588  // changed.
589  if ( $name != $page->getLocalName() && !$context->getRequest()->wasPosted() ) {
590  $query = $context->getRequest()->getQueryValues();
591  unset( $query['title'] );
592  $title = $page->getPageTitle( $par );
593  $url = $title->getFullURL( $query );
594  $context->getOutput()->redirect( $url );
595 
596  return $title;
597  }
598 
599  // @phan-suppress-next-line PhanUndeclaredMethod
600  $context->setTitle( $page->getPageTitle( $par ) );
601  } elseif ( !$page->isIncludable() ) {
602  return false;
603  }
604 
605  $page->including( $including );
606  if ( $linkRenderer ) {
607  $page->setLinkRenderer( $linkRenderer );
608  }
609 
610  // Execute special page
611  $page->run( $par );
612 
613  return true;
614  }
615 
631  public function capturePath(
632  Title $title, IContextSource $context, LinkRenderer $linkRenderer = null
633  ) {
634  global $wgTitle, $wgOut, $wgRequest, $wgUser, $wgLang;
635  $main = RequestContext::getMain();
636 
637  // Save current globals and main context
638  $glob = [
639  'title' => $wgTitle,
640  'output' => $wgOut,
641  'request' => $wgRequest,
642  'user' => $wgUser,
643  'language' => $wgLang,
644  ];
645  $ctx = [
646  'title' => $main->getTitle(),
647  'output' => $main->getOutput(),
648  'request' => $main->getRequest(),
649  'user' => $main->getUser(),
650  'language' => $main->getLanguage(),
651  ];
652  if ( $main->canUseWikiPage() ) {
653  $ctx['wikipage'] = $main->getWikiPage();
654  }
655 
656  // Override
657  $wgTitle = $title;
660  $wgUser = $context->getUser();
662  $main->setTitle( $title );
663  $main->setOutput( $context->getOutput() );
664  $main->setRequest( $context->getRequest() );
665  $main->setUser( $context->getUser() );
666  $main->setLanguage( $context->getLanguage() );
667 
668  // The useful part
669  $ret = $this->executePath( $title, $context, true, $linkRenderer );
670 
671  // Restore old globals and context
672  $wgTitle = $glob['title'];
673  $wgOut = $glob['output'];
674  $wgRequest = $glob['request'];
675  $wgUser = $glob['user'];
676  $wgLang = $glob['language'];
677  $main->setTitle( $ctx['title'] );
678  $main->setOutput( $ctx['output'] );
679  $main->setRequest( $ctx['request'] );
680  $main->setUser( $ctx['user'] );
681  $main->setLanguage( $ctx['language'] );
682  if ( isset( $ctx['wikipage'] ) ) {
683  $main->setWikiPage( $ctx['wikipage'] );
684  }
685 
686  return $ret;
687  }
688 
696  public function getLocalNameFor( $name, $subpage = false ) {
697  $aliases = $this->contLang->getSpecialPageAliases();
698  $aliasList = $this->getAliasList();
699 
700  // Find the first alias that maps back to $name
701  if ( isset( $aliases[$name] ) ) {
702  $found = false;
703  foreach ( $aliases[$name] as $alias ) {
704  $caseFoldedAlias = $this->contLang->caseFold( $alias );
705  $caseFoldedAlias = str_replace( ' ', '_', $caseFoldedAlias );
706  if ( isset( $aliasList[$caseFoldedAlias] ) &&
707  $aliasList[$caseFoldedAlias] === $name
708  ) {
709  $name = $alias;
710  $found = true;
711  break;
712  }
713  }
714  if ( !$found ) {
715  wfWarn( "Did not find a usable alias for special page '$name'. " .
716  "It seems all defined aliases conflict?" );
717  }
718  } else {
719  // Check if someone misspelled the correct casing
720  if ( is_array( $aliases ) ) {
721  foreach ( $aliases as $n => $values ) {
722  if ( strcasecmp( $name, $n ) === 0 ) {
723  wfWarn( "Found alias defined for $n when searching for " .
724  "special page aliases for $name. Case mismatch?" );
725  return $this->getLocalNameFor( $n, $subpage );
726  }
727  }
728  }
729 
730  wfWarn( "Did not find alias for special page '$name'. " .
731  "Perhaps no aliases are defined for it?" );
732  }
733 
734  if ( $subpage !== false && !is_null( $subpage ) ) {
735  // Make sure it's in dbkey form
736  $subpage = str_replace( ' ', '_', $subpage );
737  $name = "$name/$subpage";
738  }
739 
740  return $this->contLang->ucfirst( $name );
741  }
742 
749  public function getTitleForAlias( $alias ) {
750  list( $name, $subpage ) = $this->resolveAlias( $alias );
751  if ( $name != null ) {
752  return SpecialPage::getTitleFor( $name, $subpage );
753  }
754 
755  return null;
756  }
757 }
$wgSend404Code
$wgSend404Code
Some web hosts attempt to rewrite all responses with a 404 (not found) status code,...
Definition: DefaultSettings.php:3535
MediaWiki\Special\SpecialPageFactory\getAliasList
getAliasList()
Initialise and return the list of special page aliases.
Definition: SpecialPageFactory.php:337
MediaWiki\Special
Definition: SpecialPageFactory.php:25
Profiler\instance
static instance()
Singleton.
Definition: Profiler.php:63
MediaWiki\Special\SpecialPageFactory\$options
ServiceOptions $options
Definition: SpecialPageFactory.php:232
MediaWiki\Special\SpecialPageFactory\CORE_LIST
const CORE_LIST
List of special page names to the subclass of SpecialPage which handles them.
Definition: SpecialPageFactory.php:68
MediaWiki\Linker\LinkRenderer
Class that generates HTML links for pages.
Definition: LinkRenderer.php:41
MediaWiki\Special\SpecialPageFactory\getRegularPages
getRegularPages()
Return categorised listable special pages for all users.
Definition: SpecialPageFactory.php:497
MediaWiki\Special\SpecialPageFactory\getNames
getNames()
Returns a list of canonical special page names.
Definition: SpecialPageFactory.php:277
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:83
MediaWiki\Special\SpecialPageFactory\getPageList
getPageList()
Get the special page list as an array.
Definition: SpecialPageFactory.php:286
wfLogWarning
wfLogWarning( $msg, $callerOffset=1, $level=E_USER_WARNING)
Send a warning as a PHP error and the debug log.
Definition: GlobalFunctions.php:1078
$wgTitle
if(isset( $_SERVER['PATH_INFO']) && $_SERVER['PATH_INFO'] !='') $wgTitle
Definition: api.php:53
MediaWiki\Special\SpecialPageFactory\getUsablePages
getUsablePages(User $user)
Return categorised listable special pages which are available for the current user,...
Definition: SpecialPageFactory.php:475
MediaWiki\Special\SpecialPageFactory\__construct
__construct(ServiceOptions $options, Language $contLang, ObjectFactory $objectFactory)
Definition: SpecialPageFactory.php:260
MediaWiki\Special\SpecialPageFactory\getTitleForAlias
getTitleForAlias( $alias)
Get a title for a given alias.
Definition: SpecialPageFactory.php:749
MediaWiki\Config\ServiceOptions
A class for passing options to services.
Definition: ServiceOptions.php:25
wfDeprecated
wfDeprecated( $function, $version=false, $component=false, $callerOffset=2)
Throws a warning that $function is deprecated.
Definition: GlobalFunctions.php:1044
MediaWiki\Special\SpecialPageFactory\$list
array $list
Special page name => class name.
Definition: SpecialPageFactory.php:226
Profiler
Profiler base class that defines the interface and some trivial functionality.
Definition: Profiler.php:33
$wgLang
$wgLang
Definition: Setup.php:858
MediaWiki\Special\SpecialPageFactory\executePath
executePath(Title &$title, IContextSource &$context, $including=false, LinkRenderer $linkRenderer=null)
Execute a special page path.
Definition: SpecialPageFactory.php:547
MediaWiki\Special\SpecialPageFactory\getLocalNameFor
getLocalNameFor( $name, $subpage=false)
Get the local name for a specified canonical name.
Definition: SpecialPageFactory.php:696
$title
$title
Definition: testCompression.php:36
RequestContext
Group all the pieces relevant to the context of a request into one instance.
Definition: RequestContext.php:33
MediaWiki\Special\SpecialPageFactory\$contLang
Language $contLang
Definition: SpecialPageFactory.php:235
MediaWiki\Special\SpecialPageFactory
Factory for handling the special page list and generating SpecialPage objects.
Definition: SpecialPageFactory.php:64
SpecialPage
Parent class for all special pages.
Definition: SpecialPage.php:37
MediaWiki\Special\SpecialPageFactory\getRestrictedPages
getRestrictedPages(User $user)
Return categorised listable special pages which are available for the current user,...
Definition: SpecialPageFactory.php:516
IContextSource\getUser
getUser()
MediaWiki\Special\SpecialPageFactory\getPage
getPage( $name)
Find the object with a given name and return it (or NULL)
Definition: SpecialPageFactory.php:427
RequestContext\getMain
static getMain()
Get the RequestContext object associated with the main request.
Definition: RequestContext.php:445
IContextSource
Interface for objects which can provide a MediaWiki context on request.
Definition: IContextSource.php:53
Title
Represents a title within MediaWiki.
Definition: Title.php:42
MediaWiki\Special\SpecialPageFactory\resolveAlias
resolveAlias( $alias)
Given a special page name with a possible subpage, return an array where the first element is the spe...
Definition: SpecialPageFactory.php:393
MediaWiki\Special\SpecialPageFactory\$objectFactory
ObjectFactory $objectFactory
Definition: SpecialPageFactory.php:238
IContextSource\getConfig
getConfig()
Get the site configuration.
MediaWiki\Special\SpecialPageFactory\capturePath
capturePath(Title $title, IContextSource $context, LinkRenderer $linkRenderer=null)
Just like executePath() but will override global variables and execute the page in "inclusion" mode.
Definition: SpecialPageFactory.php:631
IContextSource\getRequest
getRequest()
wfWarn
wfWarn( $msg, $callerOffset=1, $level=E_USER_NOTICE)
Send a warning either to the debug log or in a PHP error depending on $wgDevelopmentWarnings.
Definition: GlobalFunctions.php:1065
$wgRequest
if(! $wgDBerrorLogTZ) $wgRequest
Definition: Setup.php:729
MediaWiki\$context
IContextSource $context
Definition: MediaWiki.php:37
$wgOut
$wgOut
Definition: Setup.php:863
User
The User object encapsulates all of the user-specific settings (user_id, name, rights,...
Definition: User.php:51
Hooks\run
static run( $event, array $args=[], $deprecatedVersion=null)
Call hook functions defined in Hooks::register and $wgHooks.
Definition: Hooks.php:200
IContextSource\getOutput
getOutput()
MediaWiki\Special\SpecialPageFactory\$aliases
array $aliases
Definition: SpecialPageFactory.php:229
Language
Internationalisation code.
Definition: Language.php:39
MediaWiki\Special\SpecialPageFactory\exists
exists( $name)
Check if a given name exist as a special page or as a special page alias.
Definition: SpecialPageFactory.php:414
Hooks
Hooks class.
Definition: Hooks.php:34
IContextSource\getLanguage
getLanguage()
MediaWiki\Config\ServiceOptions\assertRequiredOptions
assertRequiredOptions(array $expectedKeys)
Assert that the list of options provided in this instance exactly match $expectedKeys,...
Definition: ServiceOptions.php:62