MediaWiki  master
SpecialPageFactory.php
Go to the documentation of this file.
1 <?php
25 namespace MediaWiki\SpecialPage;
26 
27 use IContextSource;
28 use Language;
33 use Profiler;
34 use RequestContext;
35 use SpecialPage;
36 use Title;
37 use User;
38 use Wikimedia\ObjectFactory;
39 
69  private const CORE_LIST = [
70  // Maintenance Reports
71  'BrokenRedirects' => \SpecialBrokenRedirects::class,
72  'Deadendpages' => \SpecialDeadendPages::class,
73  'DoubleRedirects' => \SpecialDoubleRedirects::class,
74  'Longpages' => \SpecialLongPages::class,
75  'Ancientpages' => \SpecialAncientPages::class,
76  'Lonelypages' => \SpecialLonelyPages::class,
77  'Fewestrevisions' => \SpecialFewestRevisions::class,
78  'Withoutinterwiki' => \SpecialWithoutInterwiki::class,
79  'Protectedpages' => \SpecialProtectedpages::class,
80  'Protectedtitles' => \SpecialProtectedtitles::class,
81  'Shortpages' => \SpecialShortPages::class,
82  'Uncategorizedcategories' => \SpecialUncategorizedCategories::class,
83  'Uncategorizedimages' => \SpecialUncategorizedImages::class,
84  'Uncategorizedpages' => \SpecialUncategorizedPages::class,
85  'Uncategorizedtemplates' => \SpecialUncategorizedTemplates::class,
86  'Unusedcategories' => \SpecialUnusedCategories::class,
87  'Unusedimages' => \SpecialUnusedImages::class,
88  'Unusedtemplates' => \SpecialUnusedTemplates::class,
89  'Unwatchedpages' => \SpecialUnwatchedPages::class,
90  'Wantedcategories' => \SpecialWantedCategories::class,
91  'Wantedfiles' => \WantedFilesPage::class,
92  'Wantedpages' => \WantedPagesPage::class,
93  'Wantedtemplates' => \SpecialWantedTemplates::class,
94 
95  // List of pages
96  'Allpages' => \SpecialAllPages::class,
97  'Prefixindex' => \SpecialPrefixindex::class,
98  'Categories' => \SpecialCategories::class,
99  'Listredirects' => \SpecialListRedirects::class,
100  'PagesWithProp' => \SpecialPagesWithProp::class,
101  'TrackingCategories' => \SpecialTrackingCategories::class,
102 
103  // Authentication
104  'Userlogin' => \SpecialUserLogin::class,
105  'Userlogout' => \SpecialUserLogout::class,
106  'CreateAccount' => [
107  'class' => \SpecialCreateAccount::class,
108  'services' => [
109  'PermissionManager',
110  ]
111  ],
112  'LinkAccounts' => \SpecialLinkAccounts::class,
113  'UnlinkAccounts' => \SpecialUnlinkAccounts::class,
114  'ChangeCredentials' => \SpecialChangeCredentials::class,
115  'RemoveCredentials' => \SpecialRemoveCredentials::class,
116 
117  // Users and rights
118  'Activeusers' => \SpecialActiveUsers::class,
119  'Block' => [
120  'class' => \SpecialBlock::class,
121  'services' => [
122  'PermissionManager'
123  ]
124  ],
125  'Unblock' => \SpecialUnblock::class,
126  'BlockList' => \SpecialBlockList::class,
127  'AutoblockList' => [
128  'class' => \SpecialAutoblockList::class,
129  'services' => [
130  'PermissionManager',
131  ],
132  ],
133  'ChangePassword' => \SpecialChangePassword::class,
134  'BotPasswords' => \SpecialBotPasswords::class,
135  'PasswordReset' => [
136  'class' => \SpecialPasswordReset::class,
137  'services' => [
138  'PasswordReset'
139  ]
140  ],
141  'DeletedContributions' => \SpecialDeletedContributions::class,
142  'Preferences' => \SpecialPreferences::class,
143  'ResetTokens' => \SpecialResetTokens::class,
144  'Contributions' => \SpecialContributions::class,
145  'Listgrouprights' => \SpecialListGroupRights::class,
146  'Listgrants' => \SpecialListGrants::class,
147  'Listusers' => \SpecialListUsers::class,
148  'Listadmins' => \SpecialListAdmins::class,
149  'Listbots' => \SpecialListBots::class,
150  'Userrights' => \UserrightsPage::class,
151  'EditWatchlist' => [
152  'class' => \SpecialEditWatchlist::class,
153  'services' => [
154  'WatchedItemStore'
155  ]
156  ],
157  'PasswordPolicies' => [
158  'class' => \SpecialPasswordPolicies::class,
159  'services' => [
160  'NamespaceInfo'
161  ]
162  ],
163 
164  // Recent changes and logs
165  'Newimages' => \SpecialNewFiles::class,
166  'Log' => \SpecialLog::class,
167  'Watchlist' => \SpecialWatchlist::class,
168  'Newpages' => \SpecialNewpages::class,
169  'Recentchanges' => \SpecialRecentChanges::class,
170  'Recentchangeslinked' => \SpecialRecentChangesLinked::class,
171  'Tags' => \SpecialTags::class,
172 
173  // Media reports and uploads
174  'Listfiles' => \SpecialListFiles::class,
175  'Filepath' => \SpecialFilepath::class,
176  'MediaStatistics' => \SpecialMediaStatistics::class,
177  'MIMEsearch' => \SpecialMIMESearch::class,
178  'FileDuplicateSearch' => \SpecialFileDuplicateSearch::class,
179  'Upload' => \SpecialUpload::class,
180  'UploadStash' => \SpecialUploadStash::class,
181  'ListDuplicatedFiles' => \SpecialListDuplicatedFiles::class,
182 
183  // Data and tools
184  'ApiSandbox' => [
185  'class' => \SpecialApiSandbox::class,
186  'services' => [
187  'PermissionManager',
188  ],
189  ],
190  'Statistics' => \SpecialStatistics::class,
191  'Allmessages' => [
192  'class' => \SpecialAllMessages::class,
193  'services' => [
194  'ContentLanguage'
195  ]
196  ],
197  'Version' => \SpecialVersion::class,
198  'Lockdb' => \SpecialLockdb::class,
199  'Unlockdb' => \SpecialUnlockdb::class,
200 
201  // Redirecting special pages
202  'LinkSearch' => \SpecialLinkSearch::class,
203  'Randompage' => \RandomPage::class,
204  'RandomInCategory' => \SpecialRandomInCategory::class,
205  'Randomredirect' => \SpecialRandomredirect::class,
206  'Randomrootpage' => \SpecialRandomrootpage::class,
207  'GoToInterwiki' => \SpecialGoToInterwiki::class,
208 
209  // High use pages
210  'Mostlinkedcategories' => \SpecialMostLinkedCategories::class,
211  'Mostimages' => \MostimagesPage::class,
212  'Mostinterwikis' => \SpecialMostInterwikis::class,
213  'Mostlinked' => \SpecialMostLinked::class,
214  'Mostlinkedtemplates' => \SpecialMostLinkedTemplates::class,
215  'Mostcategories' => \SpecialMostCategories::class,
216  'Mostrevisions' => \SpecialMostRevisions::class,
217 
218  // Page tools
219  'ComparePages' => \SpecialComparePages::class,
220  'Export' => \SpecialExport::class,
221  'Import' => \SpecialImport::class,
222  'Undelete' => \SpecialUndelete::class,
223  'Whatlinkshere' => \SpecialWhatLinksHere::class,
224  'MergeHistory' => \SpecialMergeHistory::class,
225  'ExpandTemplates' => \SpecialExpandTemplates::class,
226  'ChangeContentModel' => [
227  'class' => \SpecialChangeContentModel::class,
228  'services' => [
229  'ContentHandlerFactory',
230  ],
231  ],
232 
233  // Other
234  'Booksources' => \SpecialBookSources::class,
235 
236  // Unlisted / redirects
237  'ApiHelp' => \SpecialApiHelp::class,
238  'Blankpage' => \SpecialBlankpage::class,
239  'Diff' => \SpecialDiff::class,
240  'EditPage' => \SpecialEditPage::class,
241  'EditTags' => [
242  'class' => \SpecialEditTags::class,
243  'services' => [
244  'PermissionManager',
245  ],
246  ],
247  'Emailuser' => \SpecialEmailUser::class,
248  'Movepage' => \MovePageForm::class,
249  'Mycontributions' => \SpecialMycontributions::class,
250  'MyLanguage' => \SpecialMyLanguage::class,
251  'Mypage' => \SpecialMypage::class,
252  'Mytalk' => \SpecialMytalk::class,
253  'PageHistory' => \SpecialPageHistory::class,
254  'PageInfo' => \SpecialPageInfo::class,
255  'Purge' => \SpecialPurge::class,
256  'Myuploads' => \SpecialMyuploads::class,
257  'AllMyUploads' => \SpecialAllMyUploads::class,
258  'NewSection' => \SpecialNewSection::class,
259  'PermanentLink' => \SpecialPermanentLink::class,
260  'Redirect' => [
261  'class' => \SpecialRedirect::class,
262  'services' => [
263  'PermissionManager',
264  'RepoGroup'
265  ]
266  ],
267  'Revisiondelete' => [
268  'class' => \SpecialRevisionDelete::class,
269  'services' => [
270  'PermissionManager',
271  'RepoGroup',
272  ],
273  ],
274  'RunJobs' => \SpecialRunJobs::class,
275  'Specialpages' => \SpecialSpecialpages::class,
276  'PageData' => \SpecialPageData::class,
277  ];
278 
280  private $list;
281 
283  private $aliases;
284 
286  private $options;
287 
289  private $contLang;
290 
292  private $objectFactory;
293 
295  private $hookContainer;
296 
298  private $hookRunner;
299 
304  public const CONSTRUCTOR_OPTIONS = [
305  'DisableInternalSearch',
306  'EmailAuthentication',
307  'EnableEmail',
308  'EnableJavaScriptTest',
309  'EnableSpecialMute',
310  'PageLanguageUseDB',
311  'SpecialPages',
312  ];
313 
320  public function __construct(
323  ObjectFactory $objectFactory,
325  ) {
326  $options->assertRequiredOptions( self::CONSTRUCTOR_OPTIONS );
327  $this->options = $options;
328  $this->contLang = $contLang;
329  $this->objectFactory = $objectFactory;
330  $this->hookContainer = $hookContainer;
331  $this->hookRunner = new HookRunner( $hookContainer );
332  }
333 
340  public function getNames() : array {
341  return array_keys( $this->getPageList() );
342  }
343 
349  private function getPageList() : array {
350  if ( !is_array( $this->list ) ) {
351  $this->list = self::CORE_LIST;
352 
353  if ( !$this->options->get( 'DisableInternalSearch' ) ) {
354  $this->list['Search'] = \SpecialSearch::class;
355  }
356 
357  if ( $this->options->get( 'EmailAuthentication' ) ) {
358  $this->list['Confirmemail'] = [
359  'class' => \SpecialConfirmEmail::class,
360  'services' => [
361  'PermissionManager',
362  ]
363  ];
364  $this->list['Invalidateemail'] = \SpecialEmailInvalidate::class;
365  }
366 
367  if ( $this->options->get( 'EnableEmail' ) ) {
368  $this->list['ChangeEmail'] = [
369  'class' => \SpecialChangeEmail::class,
370  'services' => [
371  'PermissionManager',
372  ],
373  ];
374  }
375 
376  if ( $this->options->get( 'EnableJavaScriptTest' ) ) {
377  $this->list['JavaScriptTest'] = \SpecialJavaScriptTest::class;
378  }
379 
380  if ( $this->options->get( 'EnableSpecialMute' ) ) {
381  $this->list['Mute'] = \SpecialMute::class;
382  }
383 
384  if ( $this->options->get( 'PageLanguageUseDB' ) ) {
385  $this->list['PageLanguage'] = \SpecialPageLanguage::class;
386  }
387 
388  // Add extension special pages
389  $this->list = array_merge( $this->list, $this->options->get( 'SpecialPages' ) );
390 
391  // This hook can be used to disable unwanted core special pages
392  // or conditionally register special pages.
393  $this->hookRunner->onSpecialPage_initList( $this->list );
394  }
395 
396  return $this->list;
397  }
398 
405  private function getAliasList() : array {
406  if ( $this->aliases === null ) {
407  $aliases = $this->contLang->getSpecialPageAliases();
408  $pageList = $this->getPageList();
409 
410  $this->aliases = [];
411  $keepAlias = [];
412 
413  // Force every canonical name to be an alias for itself.
414  foreach ( $pageList as $name => $stuff ) {
415  $caseFoldedAlias = $this->contLang->caseFold( $name );
416  $this->aliases[$caseFoldedAlias] = $name;
417  $keepAlias[$caseFoldedAlias] = 'canonical';
418  }
419 
420  // Check for $aliases being an array since Language::getSpecialPageAliases can return null
421  if ( is_array( $aliases ) ) {
422  foreach ( $aliases as $realName => $aliasList ) {
423  $aliasList = array_values( $aliasList );
424  foreach ( $aliasList as $i => $alias ) {
425  $caseFoldedAlias = $this->contLang->caseFold( $alias );
426 
427  if ( isset( $this->aliases[$caseFoldedAlias] ) &&
428  $realName === $this->aliases[$caseFoldedAlias]
429  ) {
430  // Ignore same-realName conflicts
431  continue;
432  }
433 
434  if ( !isset( $keepAlias[$caseFoldedAlias] ) ) {
435  $this->aliases[$caseFoldedAlias] = $realName;
436  if ( !$i ) {
437  $keepAlias[$caseFoldedAlias] = 'first';
438  }
439  } elseif ( !$i ) {
440  wfWarn( "First alias '$alias' for $realName conflicts with " .
441  "{$keepAlias[$caseFoldedAlias]} alias for " .
442  $this->aliases[$caseFoldedAlias]
443  );
444  }
445  }
446  }
447  }
448  }
449 
450  return $this->aliases;
451  }
452 
461  public function resolveAlias( $alias ) {
462  $bits = explode( '/', $alias, 2 );
463 
464  $caseFoldedAlias = $this->contLang->caseFold( $bits[0] );
465  $caseFoldedAlias = str_replace( ' ', '_', $caseFoldedAlias );
466  $aliases = $this->getAliasList();
467  if ( !isset( $aliases[$caseFoldedAlias] ) ) {
468  return [ null, null ];
469  }
470  $name = $aliases[$caseFoldedAlias];
471  $par = $bits[1] ?? null; // T4087
472 
473  return [ $name, $par ];
474  }
475 
482  public function exists( $name ) {
483  list( $title, /*...*/ ) = $this->resolveAlias( $name );
484 
485  $specialPageList = $this->getPageList();
486  return isset( $specialPageList[$title] );
487  }
488 
495  public function getPage( $name ) {
496  list( $realName, /*...*/ ) = $this->resolveAlias( $name );
497 
498  $specialPageList = $this->getPageList();
499 
500  if ( isset( $specialPageList[$realName] ) ) {
501  $rec = $specialPageList[$realName];
502 
503  if ( $rec instanceof SpecialPage ) {
505  "A SpecialPage instance for $realName was found in " .
506  '$wgSpecialPages or came from a SpecialPage_initList hook handler, ' .
507  'this was deprecated in MediaWiki 1.34',
508  '1.34'
509  );
510 
511  $page = $rec; // XXX: we should deep clone here
512  } elseif ( is_array( $rec ) || is_string( $rec ) || is_callable( $rec ) ) {
513  $page = $this->objectFactory->createObject(
514  $rec,
515  [
516  'allowClassName' => true,
517  'allowCallable' => true
518  ]
519  );
520  } else {
521  $page = null;
522  }
523 
524  if ( $page instanceof SpecialPage ) {
525  $page->setHookContainer( $this->hookContainer );
526  return $page;
527  }
528 
529  // It's not a classname, nor a callback, nor a legacy constructor array,
530  // nor a special page object. Give up.
531  wfLogWarning( "Cannot instantiate special page $realName: bad spec!" );
532  }
533 
534  return null;
535  }
536 
545  public function getUsablePages( User $user ) : array {
546  $pages = [];
547  foreach ( $this->getPageList() as $name => $rec ) {
548  $page = $this->getPage( $name );
549  if ( $page ) { // not null
550  $page->setContext( RequestContext::getMain() );
551  if ( $page->isListed()
552  && ( !$page->isRestricted() || $page->userCanExecute( $user ) )
553  ) {
554  $pages[$name] = $page;
555  }
556  }
557  }
558 
559  return $pages;
560  }
561 
567  public function getRegularPages() : array {
568  $pages = [];
569  foreach ( $this->getPageList() as $name => $rec ) {
570  $page = $this->getPage( $name );
571  if ( $page && $page->isListed() && !$page->isRestricted() ) {
572  $pages[$name] = $page;
573  }
574  }
575 
576  return $pages;
577  }
578 
586  public function getRestrictedPages( User $user ) : array {
587  $pages = [];
588  foreach ( $this->getPageList() as $name => $rec ) {
589  $page = $this->getPage( $name );
590  if ( $page
591  && $page->isListed()
592  && $page->isRestricted()
593  && $page->userCanExecute( $user )
594  ) {
595  $pages[$name] = $page;
596  }
597  }
598 
599  return $pages;
600  }
601 
617  public function executePath( Title &$title, IContextSource &$context, $including = false,
618  LinkRenderer $linkRenderer = null
619  ) {
620  // @todo FIXME: Redirects broken due to this call
621  $bits = explode( '/', $title->getDBkey(), 2 );
622  $name = $bits[0];
623  $par = $bits[1] ?? null; // T4087
624 
625  $page = $this->getPage( $name );
626  if ( !$page ) {
627  $context->getOutput()->setArticleRelated( false );
628  $context->getOutput()->setRobotPolicy( 'noindex,nofollow' );
629 
630  global $wgSend404Code;
631  if ( $wgSend404Code ) {
632  $context->getOutput()->setStatusCode( 404 );
633  }
634 
635  $context->getOutput()->showErrorPage( 'nosuchspecialpage', 'nospecialpagetext' );
636 
637  return false;
638  }
639 
640  if ( !$including ) {
641  // Narrow DB query expectations for this HTTP request
642  $trxLimits = $context->getConfig()->get( 'TrxProfilerLimits' );
643  $trxProfiler = Profiler::instance()->getTransactionProfiler();
644  if ( $context->getRequest()->wasPosted() && !$page->doesWrites() ) {
645  $trxProfiler->setExpectations( $trxLimits['POST-nonwrite'], __METHOD__ );
646  $context->getRequest()->markAsSafeRequest();
647  }
648  }
649 
650  // Page exists, set the context
651  $page->setContext( $context );
652 
653  if ( !$including ) {
654  // Redirect to canonical alias for GET commands
655  // Not for POST, we'd lose the post data, so it's best to just distribute
656  // the request. Such POST requests are possible for old extensions that
657  // generate self-links without being aware that their default name has
658  // changed.
659  if ( $name != $page->getLocalName() && !$context->getRequest()->wasPosted() ) {
660  $query = $context->getRequest()->getQueryValues();
661  unset( $query['title'] );
662  $title = $page->getPageTitle( $par );
663  $url = $title->getFullURL( $query );
664  $context->getOutput()->redirect( $url );
665 
666  return $title;
667  }
668 
669  // @phan-suppress-next-line PhanUndeclaredMethod
670  $context->setTitle( $page->getPageTitle( $par ) );
671  } elseif ( !$page->isIncludable() ) {
672  return false;
673  }
674 
675  $page->including( $including );
676  if ( $linkRenderer ) {
677  $page->setLinkRenderer( $linkRenderer );
678  }
679 
680  // Execute special page
681  $page->run( $par );
682 
683  return true;
684  }
685 
701  public function capturePath(
702  Title $title, IContextSource $context, LinkRenderer $linkRenderer = null
703  ) {
704  global $wgTitle, $wgOut, $wgRequest, $wgUser, $wgLang;
705  $main = RequestContext::getMain();
706 
707  // Save current globals and main context
708  $glob = [
709  'title' => $wgTitle,
710  'output' => $wgOut,
711  'request' => $wgRequest,
712  'user' => $wgUser,
713  'language' => $wgLang,
714  ];
715  $ctx = [
716  'title' => $main->getTitle(),
717  'output' => $main->getOutput(),
718  'request' => $main->getRequest(),
719  'user' => $main->getUser(),
720  'language' => $main->getLanguage(),
721  ];
722  if ( $main->canUseWikiPage() ) {
723  $ctx['wikipage'] = $main->getWikiPage();
724  }
725 
726  // Override
727  $wgTitle = $title;
730  $wgUser = $context->getUser();
732  $main->setTitle( $title );
733  $main->setOutput( $context->getOutput() );
734  $main->setRequest( $context->getRequest() );
735  $main->setUser( $context->getUser() );
736  $main->setLanguage( $context->getLanguage() );
737 
738  // The useful part
739  $ret = $this->executePath( $title, $context, true, $linkRenderer );
740 
741  // Restore old globals and context
742  $wgTitle = $glob['title'];
743  $wgOut = $glob['output'];
744  $wgRequest = $glob['request'];
745  $wgUser = $glob['user'];
746  $wgLang = $glob['language'];
747  $main->setTitle( $ctx['title'] );
748  $main->setOutput( $ctx['output'] );
749  $main->setRequest( $ctx['request'] );
750  $main->setUser( $ctx['user'] );
751  $main->setLanguage( $ctx['language'] );
752  if ( isset( $ctx['wikipage'] ) ) {
753  $main->setWikiPage( $ctx['wikipage'] );
754  }
755 
756  return $ret;
757  }
758 
766  public function getLocalNameFor( $name, $subpage = false ) {
767  $aliases = $this->contLang->getSpecialPageAliases();
768  $aliasList = $this->getAliasList();
769 
770  // Find the first alias that maps back to $name
771  if ( isset( $aliases[$name] ) ) {
772  $found = false;
773  foreach ( $aliases[$name] as $alias ) {
774  $caseFoldedAlias = $this->contLang->caseFold( $alias );
775  $caseFoldedAlias = str_replace( ' ', '_', $caseFoldedAlias );
776  if ( isset( $aliasList[$caseFoldedAlias] ) &&
777  $aliasList[$caseFoldedAlias] === $name
778  ) {
779  $name = $alias;
780  $found = true;
781  break;
782  }
783  }
784  if ( !$found ) {
785  wfWarn( "Did not find a usable alias for special page '$name'. " .
786  "It seems all defined aliases conflict?" );
787  }
788  } else {
789  // Check if someone misspelled the correct casing
790  if ( is_array( $aliases ) ) {
791  foreach ( $aliases as $n => $values ) {
792  if ( strcasecmp( $name, $n ) === 0 ) {
793  wfWarn( "Found alias defined for $n when searching for " .
794  "special page aliases for $name. Case mismatch?" );
795  return $this->getLocalNameFor( $n, $subpage );
796  }
797  }
798  }
799 
800  wfWarn( "Did not find alias for special page '$name'. " .
801  "Perhaps no aliases are defined for it?" );
802  }
803 
804  if ( $subpage !== false && $subpage !== null ) {
805  // Make sure it's in dbkey form
806  $subpage = str_replace( ' ', '_', $subpage );
807  $name = "$name/$subpage";
808  }
809 
810  return $this->contLang->ucfirst( $name );
811  }
812 
819  public function getTitleForAlias( $alias ) {
820  list( $name, $subpage ) = $this->resolveAlias( $alias );
821  if ( $name != null ) {
822  return SpecialPage::getTitleFor( $name, $subpage );
823  }
824 
825  return null;
826  }
827 }
828 
830 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:3660
MediaWiki\SpecialPage\SpecialPageFactory\executePath
executePath(Title &$title, IContextSource &$context, $including=false, LinkRenderer $linkRenderer=null)
Execute a special page path.
Definition: SpecialPageFactory.php:617
MediaWiki\SpecialPage\SpecialPageFactory\__construct
__construct(ServiceOptions $options, Language $contLang, ObjectFactory $objectFactory, HookContainer $hookContainer)
Definition: SpecialPageFactory.php:320
MediaWiki\SpecialPage\SpecialPageFactory\getUsablePages
getUsablePages(User $user)
Return categorised listable special pages which are available for the current user,...
Definition: SpecialPageFactory.php:545
MediaWiki\SpecialPage\SpecialPageFactory\$options
ServiceOptions $options
Definition: SpecialPageFactory.php:286
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:69
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:65
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:461
MediaWiki\SpecialPage\SpecialPageFactory\getRestrictedPages
getRestrictedPages(User $user)
Return categorised listable special pages which are available for the current user,...
Definition: SpecialPageFactory.php:586
MediaWiki\SpecialPage\SpecialPageFactory\$hookRunner
HookRunner $hookRunner
Definition: SpecialPageFactory.php:298
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:92
wfLogWarning
wfLogWarning( $msg, $callerOffset=1, $level=E_USER_WARNING)
Send a warning as a PHP error and the debug log.
Definition: GlobalFunctions.php:1086
MediaWiki\SpecialPage\SpecialPageFactory\getLocalNameFor
getLocalNameFor( $name, $subpage=false)
Get the local name for a specified canonical name.
Definition: SpecialPageFactory.php:766
MediaWiki\SpecialPage\SpecialPageFactory\$list
array $list
Special page name => class name.
Definition: SpecialPageFactory.php:280
$wgTitle
$wgTitle
Definition: Setup.php:794
MediaWiki\SpecialPage\SpecialPageFactory\$contLang
Language $contLang
Definition: SpecialPageFactory.php:289
wfDeprecatedMsg
wfDeprecatedMsg( $msg, $version=false, $component=false, $callerOffset=2)
Log a deprecation warning with arbitrary message text.
Definition: GlobalFunctions.php:1058
MediaWiki\Config\ServiceOptions
A class for passing options to services.
Definition: ServiceOptions.php:25
Profiler
Profiler base class that defines the interface and some shared functionality.
Definition: Profiler.php:33
$wgLang
$wgLang
Definition: Setup.php:776
$title
$title
Definition: testCompression.php:38
RequestContext
Group all the pieces relevant to the context of a request into one instance @newable.
Definition: RequestContext.php:38
MediaWiki\SpecialPage\SpecialPageFactory\getNames
getNames()
Returns a list of canonical special page names.
Definition: SpecialPageFactory.php:340
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:482
SpecialPage
Parent class for all special pages.
Definition: SpecialPage.php:41
MediaWiki\SpecialPage\SpecialPageFactory\getRegularPages
getRegularPages()
Return categorised listable special pages for all users.
Definition: SpecialPageFactory.php:567
MediaWiki\SpecialPage\SpecialPageFactory\$objectFactory
ObjectFactory $objectFactory
Definition: SpecialPageFactory.php:292
IContextSource\getUser
getUser()
MediaWiki\SpecialPage\SpecialPageFactory\getPage
getPage( $name)
Find the object with a given name and return it (or NULL)
Definition: SpecialPageFactory.php:495
RequestContext\getMain
static getMain()
Get the RequestContext object associated with the main request.
Definition: RequestContext.php:453
IContextSource
Interface for objects which can provide a MediaWiki context on request.
Definition: IContextSource.php:55
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:701
IContextSource\getConfig
getConfig()
Get the site configuration.
MediaWiki\SpecialPage\SpecialPageFactory\$hookContainer
HookContainer $hookContainer
Definition: SpecialPageFactory.php:295
IContextSource\getRequest
getRequest()
MediaWiki\HookContainer\HookContainer
HookContainer class.
Definition: HookContainer.php:44
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:1073
MediaWiki\HookContainer\HookRunner
This class provides an implementation of the core hook interfaces, forwarding hook calls to HookConta...
Definition: HookRunner.php:570
MediaWiki\SpecialPage\SpecialPageFactory\getTitleForAlias
getTitleForAlias( $alias)
Get a title for a given alias.
Definition: SpecialPageFactory.php:819
$wgRequest
if(! $wgDBerrorLogTZ) $wgRequest
Definition: Setup.php:644
MediaWiki\$context
IContextSource $context
Definition: MediaWiki.php:40
$wgOut
$wgOut
Definition: Setup.php:781
MediaWiki\SpecialPage\SpecialPageFactory\$aliases
array $aliases
Definition: SpecialPageFactory.php:283
MediaWiki\SpecialPage\SpecialPageFactory\getAliasList
getAliasList()
Initialise and return the list of special page aliases.
Definition: SpecialPageFactory.php:405
MediaWiki\SpecialPage\SpecialPageFactory\getPageList
getPageList()
Get the special page list as an array.
Definition: SpecialPageFactory.php:349
User
The User object encapsulates all of the user-specific settings (user_id, name, rights,...
Definition: User.php:55
MediaWiki\SpecialPage
IContextSource\getOutput
getOutput()
Language
Internationalisation code See https://www.mediawiki.org/wiki/Special:MyLanguage/Localisation for more...
Definition: Language.php:41
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