MediaWiki  master
SpecialPageFactory.php
Go to the documentation of this file.
1 <?php
25 namespace MediaWiki\SpecialPage;
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' => [
114  'class' => \SpecialBlock::class,
115  'services' => [
116  'PermissionManager'
117  ]
118  ],
119  'Unblock' => \SpecialUnblock::class,
120  'BlockList' => \SpecialBlockList::class,
121  'AutoblockList' => \SpecialAutoblockList::class,
122  'ChangePassword' => \SpecialChangePassword::class,
123  'BotPasswords' => \SpecialBotPasswords::class,
124  'PasswordReset' => \SpecialPasswordReset::class,
125  'DeletedContributions' => \SpecialDeletedContributions::class,
126  'Preferences' => \SpecialPreferences::class,
127  'ResetTokens' => \SpecialResetTokens::class,
128  'Contributions' => \SpecialContributions::class,
129  'Listgrouprights' => \SpecialListGroupRights::class,
130  'Listgrants' => \SpecialListGrants::class,
131  'Listusers' => \SpecialListUsers::class,
132  'Listadmins' => \SpecialListAdmins::class,
133  'Listbots' => \SpecialListBots::class,
134  'Userrights' => \UserrightsPage::class,
135  'EditWatchlist' => [
136  'class' => \SpecialEditWatchlist::class,
137  'services' => [
138  'WatchedItemStore'
139  ]
140  ],
141  'PasswordPolicies' => \SpecialPasswordPolicies::class,
142 
143  // Recent changes and logs
144  'Newimages' => \SpecialNewFiles::class,
145  'Log' => \SpecialLog::class,
146  'Watchlist' => \SpecialWatchlist::class,
147  'Newpages' => \SpecialNewpages::class,
148  'Recentchanges' => \SpecialRecentChanges::class,
149  'Recentchangeslinked' => \SpecialRecentChangesLinked::class,
150  'Tags' => \SpecialTags::class,
151 
152  // Media reports and uploads
153  'Listfiles' => \SpecialListFiles::class,
154  'Filepath' => \SpecialFilepath::class,
155  'MediaStatistics' => \SpecialMediaStatistics::class,
156  'MIMEsearch' => \SpecialMIMESearch::class,
157  'FileDuplicateSearch' => \SpecialFileDuplicateSearch::class,
158  'Upload' => \SpecialUpload::class,
159  'UploadStash' => \SpecialUploadStash::class,
160  'ListDuplicatedFiles' => \SpecialListDuplicatedFiles::class,
161 
162  // Data and tools
163  'ApiSandbox' => \SpecialApiSandbox::class,
164  'Statistics' => \SpecialStatistics::class,
165  'Allmessages' => \SpecialAllMessages::class,
166  'Version' => \SpecialVersion::class,
167  'Lockdb' => \SpecialLockdb::class,
168  'Unlockdb' => \SpecialUnlockdb::class,
169 
170  // Redirecting special pages
171  'LinkSearch' => \SpecialLinkSearch::class,
172  'Randompage' => \RandomPage::class,
173  'RandomInCategory' => \SpecialRandomInCategory::class,
174  'Randomredirect' => \SpecialRandomredirect::class,
175  'Randomrootpage' => \SpecialRandomrootpage::class,
176  'GoToInterwiki' => \SpecialGoToInterwiki::class,
177 
178  // High use pages
179  'Mostlinkedcategories' => \SpecialMostLinkedCategories::class,
180  'Mostimages' => \MostimagesPage::class,
181  'Mostinterwikis' => \SpecialMostInterwikis::class,
182  'Mostlinked' => \SpecialMostLinked::class,
183  'Mostlinkedtemplates' => \SpecialMostLinkedTemplates::class,
184  'Mostcategories' => \SpecialMostCategories::class,
185  'Mostrevisions' => \SpecialMostRevisions::class,
186 
187  // Page tools
188  'ComparePages' => \SpecialComparePages::class,
189  'Export' => \SpecialExport::class,
190  'Import' => \SpecialImport::class,
191  'Undelete' => \SpecialUndelete::class,
192  'Whatlinkshere' => \SpecialWhatLinksHere::class,
193  'MergeHistory' => \SpecialMergeHistory::class,
194  'ExpandTemplates' => \SpecialExpandTemplates::class,
195  'ChangeContentModel' => [
196  'class' => \SpecialChangeContentModel::class,
197  'services' => [
198  'ContentHandlerFactory',
199  ],
200  ],
201 
202  // Other
203  'Booksources' => \SpecialBookSources::class,
204 
205  // Unlisted / redirects
206  'ApiHelp' => \SpecialApiHelp::class,
207  'Blankpage' => \SpecialBlankpage::class,
208  'Diff' => \SpecialDiff::class,
209  'EditPage' => \SpecialEditPage::class,
210  'EditTags' => [
211  'class' => \SpecialEditTags::class,
212  'services' => [
213  'PermissionManager',
214  ],
215  ],
216  'Emailuser' => \SpecialEmailUser::class,
217  'Movepage' => \MovePageForm::class,
218  'Mycontributions' => \SpecialMycontributions::class,
219  'MyLanguage' => \SpecialMyLanguage::class,
220  'Mypage' => \SpecialMypage::class,
221  'Mytalk' => \SpecialMytalk::class,
222  'PageHistory' => \SpecialPageHistory::class,
223  'PageInfo' => \SpecialPageInfo::class,
224  'Purge' => \SpecialPurge::class,
225  'Myuploads' => \SpecialMyuploads::class,
226  'AllMyUploads' => \SpecialAllMyUploads::class,
227  'NewSection' => \SpecialNewSection::class,
228  'PermanentLink' => \SpecialPermanentLink::class,
229  'Redirect' => \SpecialRedirect::class,
230  'Revisiondelete' => [
231  'class' => \SpecialRevisionDelete::class,
232  'services' => [
233  'PermissionManager',
234  'RepoGroup',
235  ],
236  ],
237  'RunJobs' => \SpecialRunJobs::class,
238  'Specialpages' => \SpecialSpecialpages::class,
239  'PageData' => \SpecialPageData::class,
240  ];
241 
243  private $list;
244 
246  private $aliases;
247 
249  private $options;
250 
252  private $contLang;
253 
255  private $objectFactory;
256 
261  public const CONSTRUCTOR_OPTIONS = [
262  'DisableInternalSearch',
263  'EmailAuthentication',
264  'EnableEmail',
265  'EnableJavaScriptTest',
266  'EnableSpecialMute',
267  'PageLanguageUseDB',
268  'SpecialPages',
269  ];
270 
276  public function __construct(
279  ObjectFactory $objectFactory
280  ) {
281  $options->assertRequiredOptions( self::CONSTRUCTOR_OPTIONS );
282  $this->options = $options;
283  $this->contLang = $contLang;
284  $this->objectFactory = $objectFactory;
285  }
286 
293  public function getNames() : array {
294  return array_keys( $this->getPageList() );
295  }
296 
302  private function getPageList() : array {
303  if ( !is_array( $this->list ) ) {
304  $this->list = self::CORE_LIST;
305 
306  if ( !$this->options->get( 'DisableInternalSearch' ) ) {
307  $this->list['Search'] = \SpecialSearch::class;
308  }
309 
310  if ( $this->options->get( 'EmailAuthentication' ) ) {
311  $this->list['Confirmemail'] = \SpecialConfirmEmail::class;
312  $this->list['Invalidateemail'] = \SpecialEmailInvalidate::class;
313  }
314 
315  if ( $this->options->get( 'EnableEmail' ) ) {
316  $this->list['ChangeEmail'] = \SpecialChangeEmail::class;
317  }
318 
319  if ( $this->options->get( 'EnableJavaScriptTest' ) ) {
320  $this->list['JavaScriptTest'] = \SpecialJavaScriptTest::class;
321  }
322 
323  if ( $this->options->get( 'EnableSpecialMute' ) ) {
324  $this->list['Mute'] = \SpecialMute::class;
325  }
326 
327  if ( $this->options->get( 'PageLanguageUseDB' ) ) {
328  $this->list['PageLanguage'] = \SpecialPageLanguage::class;
329  }
330 
331  // Add extension special pages
332  $this->list = array_merge( $this->list, $this->options->get( 'SpecialPages' ) );
333 
334  // This hook can be used to disable unwanted core special pages
335  // or conditionally register special pages.
336  Hooks::run( 'SpecialPage_initList', [ &$this->list ] );
337 
338  }
339 
340  return $this->list;
341  }
342 
349  private function getAliasList() : array {
350  if ( $this->aliases === null ) {
351  $aliases = $this->contLang->getSpecialPageAliases();
352  $pageList = $this->getPageList();
353 
354  $this->aliases = [];
355  $keepAlias = [];
356 
357  // Force every canonical name to be an alias for itself.
358  foreach ( $pageList as $name => $stuff ) {
359  $caseFoldedAlias = $this->contLang->caseFold( $name );
360  $this->aliases[$caseFoldedAlias] = $name;
361  $keepAlias[$caseFoldedAlias] = 'canonical';
362  }
363 
364  // Check for $aliases being an array since Language::getSpecialPageAliases can return null
365  if ( is_array( $aliases ) ) {
366  foreach ( $aliases as $realName => $aliasList ) {
367  $aliasList = array_values( $aliasList );
368  foreach ( $aliasList as $i => $alias ) {
369  $caseFoldedAlias = $this->contLang->caseFold( $alias );
370 
371  if ( isset( $this->aliases[$caseFoldedAlias] ) &&
372  $realName === $this->aliases[$caseFoldedAlias]
373  ) {
374  // Ignore same-realName conflicts
375  continue;
376  }
377 
378  if ( !isset( $keepAlias[$caseFoldedAlias] ) ) {
379  $this->aliases[$caseFoldedAlias] = $realName;
380  if ( !$i ) {
381  $keepAlias[$caseFoldedAlias] = 'first';
382  }
383  } elseif ( !$i ) {
384  wfWarn( "First alias '$alias' for $realName conflicts with " .
385  "{$keepAlias[$caseFoldedAlias]} alias for " .
386  $this->aliases[$caseFoldedAlias]
387  );
388  }
389  }
390  }
391  }
392  }
393 
394  return $this->aliases;
395  }
396 
405  public function resolveAlias( $alias ) {
406  $bits = explode( '/', $alias, 2 );
407 
408  $caseFoldedAlias = $this->contLang->caseFold( $bits[0] );
409  $caseFoldedAlias = str_replace( ' ', '_', $caseFoldedAlias );
410  $aliases = $this->getAliasList();
411  if ( !isset( $aliases[$caseFoldedAlias] ) ) {
412  return [ null, null ];
413  }
414  $name = $aliases[$caseFoldedAlias];
415  $par = $bits[1] ?? null; // T4087
416 
417  return [ $name, $par ];
418  }
419 
426  public function exists( $name ) {
427  list( $title, /*...*/ ) = $this->resolveAlias( $name );
428 
429  $specialPageList = $this->getPageList();
430  return isset( $specialPageList[$title] );
431  }
432 
439  public function getPage( $name ) {
440  list( $realName, /*...*/ ) = $this->resolveAlias( $name );
441 
442  $specialPageList = $this->getPageList();
443 
444  if ( isset( $specialPageList[$realName] ) ) {
445  $rec = $specialPageList[$realName];
446 
447  if ( $rec instanceof SpecialPage ) {
448  wfDeprecated(
449  "a SpecialPage instance (for $realName) in " .
450  '$wgSpecialPages or from the SpecialPage_initList hook',
451  '1.34'
452  );
453 
454  $page = $rec; // XXX: we should deep clone here
455  } elseif ( is_array( $rec ) || is_string( $rec ) || is_callable( $rec ) ) {
456  $page = $this->objectFactory->createObject(
457  $rec,
458  [
459  'allowClassName' => true,
460  'allowCallable' => true
461  ]
462  );
463  } else {
464  $page = null;
465  }
466 
467  if ( $page instanceof SpecialPage ) {
468  return $page;
469  }
470 
471  // It's not a classname, nor a callback, nor a legacy constructor array,
472  // nor a special page object. Give up.
473  wfLogWarning( "Cannot instantiate special page $realName: bad spec!" );
474  }
475 
476  return null;
477  }
478 
487  public function getUsablePages( User $user ) : array {
488  $pages = [];
489  foreach ( $this->getPageList() as $name => $rec ) {
490  $page = $this->getPage( $name );
491  if ( $page ) { // not null
492  $page->setContext( RequestContext::getMain() );
493  if ( $page->isListed()
494  && ( !$page->isRestricted() || $page->userCanExecute( $user ) )
495  ) {
496  $pages[$name] = $page;
497  }
498  }
499  }
500 
501  return $pages;
502  }
503 
509  public function getRegularPages() : array {
510  $pages = [];
511  foreach ( $this->getPageList() as $name => $rec ) {
512  $page = $this->getPage( $name );
513  if ( $page && $page->isListed() && !$page->isRestricted() ) {
514  $pages[$name] = $page;
515  }
516  }
517 
518  return $pages;
519  }
520 
528  public function getRestrictedPages( User $user ) : array {
529  $pages = [];
530  foreach ( $this->getPageList() as $name => $rec ) {
531  $page = $this->getPage( $name );
532  if ( $page
533  && $page->isListed()
534  && $page->isRestricted()
535  && $page->userCanExecute( $user )
536  ) {
537  $pages[$name] = $page;
538  }
539  }
540 
541  return $pages;
542  }
543 
559  public function executePath( Title &$title, IContextSource &$context, $including = false,
560  LinkRenderer $linkRenderer = null
561  ) {
562  // @todo FIXME: Redirects broken due to this call
563  $bits = explode( '/', $title->getDBkey(), 2 );
564  $name = $bits[0];
565  $par = $bits[1] ?? null; // T4087
566 
567  $page = $this->getPage( $name );
568  if ( !$page ) {
569  $context->getOutput()->setArticleRelated( false );
570  $context->getOutput()->setRobotPolicy( 'noindex,nofollow' );
571 
572  global $wgSend404Code;
573  if ( $wgSend404Code ) {
574  $context->getOutput()->setStatusCode( 404 );
575  }
576 
577  $context->getOutput()->showErrorPage( 'nosuchspecialpage', 'nospecialpagetext' );
578 
579  return false;
580  }
581 
582  if ( !$including ) {
583  // Narrow DB query expectations for this HTTP request
584  $trxLimits = $context->getConfig()->get( 'TrxProfilerLimits' );
585  $trxProfiler = Profiler::instance()->getTransactionProfiler();
586  if ( $context->getRequest()->wasPosted() && !$page->doesWrites() ) {
587  $trxProfiler->setExpectations( $trxLimits['POST-nonwrite'], __METHOD__ );
588  $context->getRequest()->markAsSafeRequest();
589  }
590  }
591 
592  // Page exists, set the context
593  $page->setContext( $context );
594 
595  if ( !$including ) {
596  // Redirect to canonical alias for GET commands
597  // Not for POST, we'd lose the post data, so it's best to just distribute
598  // the request. Such POST requests are possible for old extensions that
599  // generate self-links without being aware that their default name has
600  // changed.
601  if ( $name != $page->getLocalName() && !$context->getRequest()->wasPosted() ) {
602  $query = $context->getRequest()->getQueryValues();
603  unset( $query['title'] );
604  $title = $page->getPageTitle( $par );
605  $url = $title->getFullURL( $query );
606  $context->getOutput()->redirect( $url );
607 
608  return $title;
609  }
610 
611  // @phan-suppress-next-line PhanUndeclaredMethod
612  $context->setTitle( $page->getPageTitle( $par ) );
613  } elseif ( !$page->isIncludable() ) {
614  return false;
615  }
616 
617  $page->including( $including );
618  if ( $linkRenderer ) {
619  $page->setLinkRenderer( $linkRenderer );
620  }
621 
622  // Execute special page
623  $page->run( $par );
624 
625  return true;
626  }
627 
643  public function capturePath(
644  Title $title, IContextSource $context, LinkRenderer $linkRenderer = null
645  ) {
646  global $wgTitle, $wgOut, $wgRequest, $wgUser, $wgLang;
647  $main = RequestContext::getMain();
648 
649  // Save current globals and main context
650  $glob = [
651  'title' => $wgTitle,
652  'output' => $wgOut,
653  'request' => $wgRequest,
654  'user' => $wgUser,
655  'language' => $wgLang,
656  ];
657  $ctx = [
658  'title' => $main->getTitle(),
659  'output' => $main->getOutput(),
660  'request' => $main->getRequest(),
661  'user' => $main->getUser(),
662  'language' => $main->getLanguage(),
663  ];
664  if ( $main->canUseWikiPage() ) {
665  $ctx['wikipage'] = $main->getWikiPage();
666  }
667 
668  // Override
669  $wgTitle = $title;
672  $wgUser = $context->getUser();
674  $main->setTitle( $title );
675  $main->setOutput( $context->getOutput() );
676  $main->setRequest( $context->getRequest() );
677  $main->setUser( $context->getUser() );
678  $main->setLanguage( $context->getLanguage() );
679 
680  // The useful part
681  $ret = $this->executePath( $title, $context, true, $linkRenderer );
682 
683  // Restore old globals and context
684  $wgTitle = $glob['title'];
685  $wgOut = $glob['output'];
686  $wgRequest = $glob['request'];
687  $wgUser = $glob['user'];
688  $wgLang = $glob['language'];
689  $main->setTitle( $ctx['title'] );
690  $main->setOutput( $ctx['output'] );
691  $main->setRequest( $ctx['request'] );
692  $main->setUser( $ctx['user'] );
693  $main->setLanguage( $ctx['language'] );
694  if ( isset( $ctx['wikipage'] ) ) {
695  $main->setWikiPage( $ctx['wikipage'] );
696  }
697 
698  return $ret;
699  }
700 
708  public function getLocalNameFor( $name, $subpage = false ) {
709  $aliases = $this->contLang->getSpecialPageAliases();
710  $aliasList = $this->getAliasList();
711 
712  // Find the first alias that maps back to $name
713  if ( isset( $aliases[$name] ) ) {
714  $found = false;
715  foreach ( $aliases[$name] as $alias ) {
716  $caseFoldedAlias = $this->contLang->caseFold( $alias );
717  $caseFoldedAlias = str_replace( ' ', '_', $caseFoldedAlias );
718  if ( isset( $aliasList[$caseFoldedAlias] ) &&
719  $aliasList[$caseFoldedAlias] === $name
720  ) {
721  $name = $alias;
722  $found = true;
723  break;
724  }
725  }
726  if ( !$found ) {
727  wfWarn( "Did not find a usable alias for special page '$name'. " .
728  "It seems all defined aliases conflict?" );
729  }
730  } else {
731  // Check if someone misspelled the correct casing
732  if ( is_array( $aliases ) ) {
733  foreach ( $aliases as $n => $values ) {
734  if ( strcasecmp( $name, $n ) === 0 ) {
735  wfWarn( "Found alias defined for $n when searching for " .
736  "special page aliases for $name. Case mismatch?" );
737  return $this->getLocalNameFor( $n, $subpage );
738  }
739  }
740  }
741 
742  wfWarn( "Did not find alias for special page '$name'. " .
743  "Perhaps no aliases are defined for it?" );
744  }
745 
746  if ( $subpage !== false && $subpage !== null ) {
747  // Make sure it's in dbkey form
748  $subpage = str_replace( ' ', '_', $subpage );
749  $name = "$name/$subpage";
750  }
751 
752  return $this->contLang->ucfirst( $name );
753  }
754 
761  public function getTitleForAlias( $alias ) {
762  list( $name, $subpage ) = $this->resolveAlias( $alias );
763  if ( $name != null ) {
764  return SpecialPage::getTitleFor( $name, $subpage );
765  }
766 
767  return null;
768  }
769 }
770 
772 class_alias( SpecialPageFactory::class, 'MediaWiki\\Special\\SpecialPageFactory' );
$wgSend404Code
$wgSend404Code
Some web hosts attempt to rewrite all responses with a 404 (not found) status code,...
Definition: DefaultSettings.php:3622
MediaWiki\SpecialPage\SpecialPageFactory\executePath
executePath(Title &$title, IContextSource &$context, $including=false, LinkRenderer $linkRenderer=null)
Execute a special page path.
Definition: SpecialPageFactory.php:559
MediaWiki\SpecialPage\SpecialPageFactory\getUsablePages
getUsablePages(User $user)
Return categorised listable special pages which are available for the current user,...
Definition: SpecialPageFactory.php:487
MediaWiki\SpecialPage\SpecialPageFactory\$options
ServiceOptions $options
Definition: SpecialPageFactory.php:249
Profiler\instance
static instance()
Singleton.
Definition: Profiler.php:63
MediaWiki\SpecialPage\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:42
MediaWiki\SpecialPage\SpecialPageFactory
Factory for handling the special page list and generating SpecialPage objects.
Definition: SpecialPageFactory.php:64
MediaWiki\SpecialPage\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:405
MediaWiki\SpecialPage\SpecialPageFactory\getRestrictedPages
getRestrictedPages(User $user)
Return categorised listable special pages which are available for the current user,...
Definition: SpecialPageFactory.php:528
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
wfLogWarning
wfLogWarning( $msg, $callerOffset=1, $level=E_USER_WARNING)
Send a warning as a PHP error and the debug log.
Definition: GlobalFunctions.php:1064
$wgTitle
if(isset( $_SERVER['PATH_INFO']) && $_SERVER['PATH_INFO'] !='') $wgTitle
Definition: api.php:59
MediaWiki\SpecialPage\SpecialPageFactory\getLocalNameFor
getLocalNameFor( $name, $subpage=false)
Get the local name for a specified canonical name.
Definition: SpecialPageFactory.php:708
MediaWiki\SpecialPage\SpecialPageFactory\$list
array $list
Special page name => class name.
Definition: SpecialPageFactory.php:243
MediaWiki\SpecialPage\SpecialPageFactory\$contLang
Language $contLang
Definition: SpecialPageFactory.php:252
MediaWiki\Config\ServiceOptions
A class for passing options to services.
Definition: ServiceOptions.php:25
wfDeprecated
wfDeprecated( $function, $version=false, $component=false, $callerOffset=2)
Logs a warning that $function is deprecated.
Definition: GlobalFunctions.php:1030
Profiler
Profiler base class that defines the interface and some shared functionality.
Definition: Profiler.php:33
$wgLang
$wgLang
Definition: Setup.php:774
$title
$title
Definition: testCompression.php:38
RequestContext
Group all the pieces relevant to the context of a request into one instance.
Definition: RequestContext.php:34
MediaWiki\SpecialPage\SpecialPageFactory\getNames
getNames()
Returns a list of canonical special page names.
Definition: SpecialPageFactory.php:293
MediaWiki\SpecialPage\SpecialPageFactory\exists
exists( $name)
Check if a given name exist as a special page or as a special page alias.
Definition: SpecialPageFactory.php:426
SpecialPage
Parent class for all special pages.
Definition: SpecialPage.php:37
MediaWiki\SpecialPage\SpecialPageFactory\getRegularPages
getRegularPages()
Return categorised listable special pages for all users.
Definition: SpecialPageFactory.php:509
MediaWiki\SpecialPage\SpecialPageFactory\$objectFactory
ObjectFactory $objectFactory
Definition: SpecialPageFactory.php:255
IContextSource\getUser
getUser()
MediaWiki\SpecialPage\SpecialPageFactory\getPage
getPage( $name)
Find the object with a given name and return it (or NULL)
Definition: SpecialPageFactory.php:439
RequestContext\getMain
static getMain()
Get the RequestContext object associated with the main request.
Definition: RequestContext.php:451
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\SpecialPage\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:643
IContextSource\getConfig
getConfig()
Get the site configuration.
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:1051
MediaWiki\SpecialPage\SpecialPageFactory\__construct
__construct(ServiceOptions $options, Language $contLang, ObjectFactory $objectFactory)
Definition: SpecialPageFactory.php:276
MediaWiki\SpecialPage\SpecialPageFactory\getTitleForAlias
getTitleForAlias( $alias)
Get a title for a given alias.
Definition: SpecialPageFactory.php:761
$wgRequest
if(! $wgDBerrorLogTZ) $wgRequest
Definition: Setup.php:641
MediaWiki\$context
IContextSource $context
Definition: MediaWiki.php:37
$wgOut
$wgOut
Definition: Setup.php:779
MediaWiki\SpecialPage\SpecialPageFactory\$aliases
array $aliases
Definition: SpecialPageFactory.php:246
MediaWiki\SpecialPage\SpecialPageFactory\getAliasList
getAliasList()
Initialise and return the list of special page aliases.
Definition: SpecialPageFactory.php:349
MediaWiki\SpecialPage\SpecialPageFactory\getPageList
getPageList()
Get the special page list as an array.
Definition: SpecialPageFactory.php:302
User
The User object encapsulates all of the user-specific settings (user_id, name, rights,...
Definition: User.php:54
Hooks\run
static run( $event, array $args=[], $deprecatedVersion=null)
Call hook functions defined in Hooks::register and $wgHooks.
Definition: Hooks.php:133
MediaWiki\SpecialPage
IContextSource\getOutput
getOutput()
Language
Internationalisation code See https://www.mediawiki.org/wiki/Special:MyLanguage/Localisation for more...
Definition: Language.php:39
Hooks
Hooks class.
Definition: Hooks.php:38
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