72 'BrokenRedirects' => \SpecialBrokenRedirects::class,
73 'Deadendpages' => \SpecialDeadendPages::class,
74 'DoubleRedirects' => \SpecialDoubleRedirects::class,
75 'Longpages' => \SpecialLongPages::class,
76 'Ancientpages' => \SpecialAncientPages::class,
77 'Lonelypages' => \SpecialLonelyPages::class,
78 'Fewestrevisions' => \SpecialFewestRevisions::class,
79 'Withoutinterwiki' => \SpecialWithoutInterwiki::class,
80 'Protectedpages' => \SpecialProtectedpages::class,
81 'Protectedtitles' => \SpecialProtectedtitles::class,
82 'Shortpages' => \SpecialShortPages::class,
83 'Uncategorizedcategories' => \SpecialUncategorizedCategories::class,
84 'Uncategorizedimages' => \SpecialUncategorizedImages::class,
85 'Uncategorizedpages' => \SpecialUncategorizedPages::class,
86 'Uncategorizedtemplates' => \SpecialUncategorizedTemplates::class,
87 'Unusedcategories' => \SpecialUnusedCategories::class,
88 'Unusedimages' => \SpecialUnusedImages::class,
89 'Unusedtemplates' => \SpecialUnusedTemplates::class,
90 'Unwatchedpages' => \SpecialUnwatchedPages::class,
91 'Wantedcategories' => \SpecialWantedCategories::class,
92 'Wantedfiles' => \WantedFilesPage::class,
93 'Wantedpages' => \WantedPagesPage::class,
94 'Wantedtemplates' => \SpecialWantedTemplates::class,
97 'Allpages' => \SpecialAllPages::class,
98 'Prefixindex' => \SpecialPrefixindex::class,
99 'Categories' => \SpecialCategories::class,
100 'Listredirects' => \SpecialListRedirects::class,
101 'PagesWithProp' => \SpecialPagesWithProp::class,
102 'TrackingCategories' => \SpecialTrackingCategories::class,
105 'Userlogin' => \SpecialUserLogin::class,
106 'Userlogout' => \SpecialUserLogout::class,
107 'CreateAccount' => \SpecialCreateAccount::class,
108 'LinkAccounts' => \SpecialLinkAccounts::class,
109 'UnlinkAccounts' => \SpecialUnlinkAccounts::class,
110 'ChangeCredentials' => \SpecialChangeCredentials::class,
111 'RemoveCredentials' => \SpecialRemoveCredentials::class,
114 'Activeusers' => \SpecialActiveUsers::class,
115 'Block' => \SpecialBlock::class,
116 'Unblock' => \SpecialUnblock::class,
117 'BlockList' => \SpecialBlockList::class,
118 'AutoblockList' => \SpecialAutoblockList::class,
119 'ChangePassword' => \SpecialChangePassword::class,
120 'BotPasswords' => \SpecialBotPasswords::class,
121 'PasswordReset' => \SpecialPasswordReset::class,
122 'DeletedContributions' => \SpecialDeletedContributions::class,
123 'Preferences' => \SpecialPreferences::class,
124 'ResetTokens' => \SpecialResetTokens::class,
125 'Contributions' => \SpecialContributions::class,
126 'Listgrouprights' => \SpecialListGroupRights::class,
127 'Listgrants' => \SpecialListGrants::class,
128 'Listusers' => \SpecialListUsers::class,
129 'Listadmins' => \SpecialListAdmins::class,
130 'Listbots' => \SpecialListBots::class,
131 'Userrights' => \UserrightsPage::class,
132 'EditWatchlist' => \SpecialEditWatchlist::class,
133 'PasswordPolicies' => \SpecialPasswordPolicies::class,
136 'Newimages' => \SpecialNewFiles::class,
137 'Log' => \SpecialLog::class,
138 'Watchlist' => \SpecialWatchlist::class,
139 'Newpages' => \SpecialNewpages::class,
140 'Recentchanges' => \SpecialRecentChanges::class,
141 'Recentchangeslinked' => \SpecialRecentChangesLinked::class,
142 'Tags' => \SpecialTags::class,
145 'Listfiles' => \SpecialListFiles::class,
146 'Filepath' => \SpecialFilepath::class,
147 'MediaStatistics' => \SpecialMediaStatistics::class,
148 'MIMEsearch' => \SpecialMIMESearch::class,
149 'FileDuplicateSearch' => \SpecialFileDuplicateSearch::class,
150 'Upload' => \SpecialUpload::class,
151 'UploadStash' => \SpecialUploadStash::class,
152 'ListDuplicatedFiles' => \SpecialListDuplicatedFiles::class,
155 'ApiSandbox' => \SpecialApiSandbox::class,
156 'Statistics' => \SpecialStatistics::class,
157 'Allmessages' => \SpecialAllMessages::class,
158 'Version' => \SpecialVersion::class,
159 'Lockdb' => \SpecialLockdb::class,
160 'Unlockdb' => \SpecialUnlockdb::class,
163 'LinkSearch' => \SpecialLinkSearch::class,
164 'Randompage' => \RandomPage::class,
165 'RandomInCategory' => \SpecialRandomInCategory::class,
166 'Randomredirect' => \SpecialRandomredirect::class,
167 'Randomrootpage' => \SpecialRandomrootpage::class,
168 'GoToInterwiki' => \SpecialGoToInterwiki::class,
171 'Mostlinkedcategories' => \SpecialMostLinkedCategories::class,
172 'Mostimages' => \MostimagesPage::class,
173 'Mostinterwikis' => \SpecialMostInterwikis::class,
174 'Mostlinked' => \SpecialMostLinked::class,
175 'Mostlinkedtemplates' => \SpecialMostLinkedTemplates::class,
176 'Mostcategories' => \SpecialMostCategories::class,
177 'Mostrevisions' => \SpecialMostRevisions::class,
180 'ComparePages' => \SpecialComparePages::class,
181 'Export' => \SpecialExport::class,
182 'Import' => \SpecialImport::class,
183 'Undelete' => \SpecialUndelete::class,
184 'Whatlinkshere' => \SpecialWhatLinksHere::class,
185 'MergeHistory' => \SpecialMergeHistory::class,
186 'ExpandTemplates' => \SpecialExpandTemplates::class,
189 'Booksources' => \SpecialBookSources::class,
192 'ApiHelp' => \SpecialApiHelp::class,
193 'Blankpage' => \SpecialBlankpage::class,
194 'Diff' => \SpecialDiff::class,
196 'class' => \SpecialEditTags::class,
201 'Emailuser' => \SpecialEmailUser::class,
202 'Movepage' => \MovePageForm::class,
203 'Mycontributions' => \SpecialMycontributions::class,
204 'MyLanguage' => \SpecialMyLanguage::class,
205 'Mypage' => \SpecialMypage::class,
206 'Mytalk' => \SpecialMytalk::class,
207 'Myuploads' => \SpecialMyuploads::class,
208 'AllMyUploads' => \SpecialAllMyUploads::class,
209 'NewSection' => \SpecialNewSection::class,
210 'PermanentLink' => \SpecialPermanentLink::class,
211 'Redirect' => \SpecialRedirect::class,
212 'Revisiondelete' => [
213 'class' => \SpecialRevisionDelete::class,
218 'RunJobs' => \SpecialRunJobs::class,
219 'Specialpages' => \SpecialSpecialpages::class,
220 'PageData' => \SpecialPageData::class,
245 'ContentHandlerUseDB',
246 'DisableInternalSearch',
247 'EmailAuthentication',
249 'EnableJavaScriptTest',
287 if ( !is_array( $this->list ) ) {
288 $this->list = self::$coreList;
290 if ( !$this->options->get(
'DisableInternalSearch' ) ) {
291 $this->list[
'Search'] = \SpecialSearch::class;
294 if ( $this->options->get(
'EmailAuthentication' ) ) {
295 $this->list[
'Confirmemail'] = \SpecialConfirmEmail::class;
296 $this->list[
'Invalidateemail'] = \SpecialEmailInvalidate::class;
299 if ( $this->options->get(
'EnableEmail' ) ) {
300 $this->list[
'ChangeEmail'] = \SpecialChangeEmail::class;
303 if ( $this->options->get(
'EnableJavaScriptTest' ) ) {
304 $this->list[
'JavaScriptTest'] = \SpecialJavaScriptTest::class;
307 if ( $this->options->get(
'EnableSpecialMute' ) ) {
308 $this->list[
'Mute'] = \SpecialMute::class;
311 if ( $this->options->get(
'PageLanguageUseDB' ) ) {
312 $this->list[
'PageLanguage'] = \SpecialPageLanguage::class;
315 if ( $this->options->get(
'ContentHandlerUseDB' ) ) {
316 $this->list[
'ChangeContentModel'] = \SpecialChangeContentModel::class;
320 $this->list = array_merge( $this->list, $this->options->get(
'SpecialPages' ) );
324 Hooks::run(
'SpecialPage_initList', [ &$this->list ] );
338 if ( is_null( $this->aliases ) ) {
339 $aliases = $this->contLang->getSpecialPageAliases();
340 $pageList = $this->getPageList();
346 foreach ( $pageList as $name => $stuff ) {
347 $caseFoldedAlias = $this->contLang->caseFold( $name );
348 $this->aliases[$caseFoldedAlias] = $name;
349 $keepAlias[$caseFoldedAlias] =
'canonical';
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 );
359 if ( isset( $this->aliases[$caseFoldedAlias] ) &&
360 $realName === $this->aliases[$caseFoldedAlias]
366 if ( !isset( $keepAlias[$caseFoldedAlias] ) ) {
367 $this->aliases[$caseFoldedAlias] = $realName;
369 $keepAlias[$caseFoldedAlias] =
'first';
372 wfWarn(
"First alias '$alias' for $realName conflicts with " .
373 "{$keepAlias[$caseFoldedAlias]} alias for " .
374 $this->aliases[$caseFoldedAlias]
382 return $this->aliases;
394 $bits = explode(
'/', $alias, 2 );
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 ];
402 $name = $aliases[$caseFoldedAlias];
403 $par = $bits[1] ??
null;
405 return [ $name, $par ];
415 list(
$title, ) = $this->resolveAlias( $name );
417 $specialPageList = $this->getPageList();
418 return isset( $specialPageList[
$title] );
428 list( $realName, ) = $this->resolveAlias( $name );
430 $specialPageList = $this->getPageList();
432 if ( isset( $specialPageList[$realName] ) ) {
433 $rec = $specialPageList[$realName];
437 "a SpecialPage instance (for $realName) in " .
438 '$wgSpecialPages or from the SpecialPage_initList hook',
443 } elseif ( is_array( $rec ) || is_string( $rec ) || is_callable( $rec ) ) {
444 $page = $this->objectFactory->createObject(
447 'allowClassName' =>
true,
448 'allowCallable' =>
true
461 wfLogWarning(
"Cannot instantiate special page $realName: bad spec!" );
477 foreach ( $this->getPageList() as $name => $rec ) {
478 $page = $this->getPage( $name );
480 $page->setContext( RequestContext::getMain() );
481 if ( $page->isListed()
482 && ( !$page->isRestricted() || $page->userCanExecute( $user ) )
484 $pages[$name] = $page;
499 foreach ( $this->getPageList() as $name => $rec ) {
500 $page = $this->getPage( $name );
501 if ( $page && $page->isListed() && !$page->isRestricted() ) {
502 $pages[$name] = $page;
518 foreach ( $this->getPageList() as $name => $rec ) {
519 $page = $this->getPage( $name );
522 && $page->isRestricted()
523 && $page->userCanExecute( $user )
525 $pages[$name] = $page;
551 $bits = explode(
'/',
$title->getDBkey(), 2 );
553 $par = $bits[1] ??
null;
555 $page = $this->getPage( $name );
557 $context->getOutput()->setArticleRelated(
false );
558 $context->getOutput()->setRobotPolicy(
'noindex,nofollow' );
562 $context->getOutput()->setStatusCode( 404 );
565 $context->getOutput()->showErrorPage(
'nosuchspecialpage',
'nospecialpagetext' );
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();
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 );
600 $context->setTitle( $page->getPageTitle( $par ) );
601 } elseif ( !$page->isIncludable() ) {
605 $page->including( $including );
606 if ( $linkRenderer ) {
607 $page->setLinkRenderer( $linkRenderer );
635 $main = RequestContext::getMain();
646 'title' => $main->getTitle(),
647 'output' => $main->getOutput(),
648 'request' => $main->getRequest(),
649 'user' => $main->getUser(),
650 'language' => $main->getLanguage(),
652 if ( $main->canUseWikiPage() ) {
653 $ctx[
'wikipage'] = $main->getWikiPage();
662 $main->setTitle(
$title );
663 $main->setOutput(
$context->getOutput() );
664 $main->setRequest(
$context->getRequest() );
665 $main->setUser(
$context->getUser() );
666 $main->setLanguage(
$context->getLanguage() );
669 $ret = $this->executePath(
$title,
$context,
true, $linkRenderer );
675 $wgUser = $glob[
'user'];
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'] );
697 $aliases = $this->contLang->getSpecialPageAliases();
698 $aliasList = $this->getAliasList();
701 if ( isset( $aliases[$name] ) ) {
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
715 wfWarn(
"Did not find a usable alias for special page '$name'. " .
716 "It seems all defined aliases conflict?" );
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 );
730 wfWarn(
"Did not find alias for special page '$name'. " .
731 "Perhaps no aliases are defined for it?" );
734 if ( $subpage !==
false && !is_null( $subpage ) ) {
736 $subpage = str_replace(
' ',
'_', $subpage );
737 $name =
"$name/$subpage";
740 return $this->contLang->ucfirst( $name );
750 list( $name, $subpage ) = $this->resolveAlias( $alias );
751 if ( $name !=
null ) {
752 return SpecialPage::getTitleFor( $name, $subpage );