9a6b787d2f0b55eab006ddf8e3bb49e1498ec744
[lhc/web/wiklou.git] / includes / specialpage / SpecialPageFactory.php
1 <?php
2 /**
3 * Factory for handling the special page list and generating SpecialPage objects.
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License along
16 * with this program; if not, write to the Free Software Foundation, Inc.,
17 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
18 * http://www.gnu.org/copyleft/gpl.html
19 *
20 * @file
21 * @ingroup SpecialPage
22 * @defgroup SpecialPage SpecialPage
23 */
24
25 /**
26 * Factory for handling the special page list and generating SpecialPage objects.
27 *
28 * To add a special page in an extension, add to $wgSpecialPages either
29 * an object instance or an array containing the name and constructor
30 * parameters. The latter is preferred for performance reasons.
31 *
32 * The object instantiated must be either an instance of SpecialPage or a
33 * sub-class thereof. It must have an execute() method, which sends the HTML
34 * for the special page to $wgOut. The parent class has an execute() method
35 * which distributes the call to the historical global functions. Additionally,
36 * execute() also checks if the user has the necessary access privileges
37 * and bails out if not.
38 *
39 * To add a core special page, use the similar static list in
40 * SpecialPageFactory::$list. To remove a core static special page at runtime, use
41 * a SpecialPage_initList hook.
42 *
43 * @ingroup SpecialPage
44 * @since 1.17
45 */
46 class SpecialPageFactory {
47 /**
48 * List of special page names to the subclass of SpecialPage which handles them.
49 */
50 private static $coreList = array(
51 // Maintenance Reports
52 'BrokenRedirects' => 'BrokenRedirectsPage',
53 'Deadendpages' => 'DeadendPagesPage',
54 'DoubleRedirects' => 'DoubleRedirectsPage',
55 'Longpages' => 'LongPagesPage',
56 'Ancientpages' => 'AncientPagesPage',
57 'Lonelypages' => 'LonelyPagesPage',
58 'Fewestrevisions' => 'FewestrevisionsPage',
59 'Withoutinterwiki' => 'WithoutInterwikiPage',
60 'Protectedpages' => 'SpecialProtectedpages',
61 'Protectedtitles' => 'SpecialProtectedtitles',
62 'Shortpages' => 'ShortPagesPage',
63 'Uncategorizedcategories' => 'UncategorizedCategoriesPage',
64 'Uncategorizedimages' => 'UncategorizedImagesPage',
65 'Uncategorizedpages' => 'UncategorizedPagesPage',
66 'Uncategorizedtemplates' => 'UncategorizedTemplatesPage',
67 'Unusedcategories' => 'UnusedCategoriesPage',
68 'Unusedimages' => 'UnusedimagesPage',
69 'Unusedtemplates' => 'UnusedtemplatesPage',
70 'Unwatchedpages' => 'UnwatchedpagesPage',
71 'Wantedcategories' => 'WantedCategoriesPage',
72 'Wantedfiles' => 'WantedFilesPage',
73 'Wantedpages' => 'WantedPagesPage',
74 'Wantedtemplates' => 'WantedTemplatesPage',
75
76 // List of pages
77 'Allpages' => 'SpecialAllPages',
78 'Prefixindex' => 'SpecialPrefixindex',
79 'Categories' => 'SpecialCategories',
80 'Listredirects' => 'ListredirectsPage',
81 'PagesWithProp' => 'SpecialPagesWithProp',
82 'TrackingCategories' => 'SpecialTrackingCategories',
83
84 // Login/create account
85 'Userlogin' => 'LoginForm',
86 'CreateAccount' => 'SpecialCreateAccount',
87
88 // Users and rights
89 'Block' => 'SpecialBlock',
90 'Unblock' => 'SpecialUnblock',
91 'BlockList' => 'SpecialBlockList',
92 'ChangePassword' => 'SpecialChangePassword',
93 'PasswordReset' => 'SpecialPasswordReset',
94 'DeletedContributions' => 'DeletedContributionsPage',
95 'Preferences' => 'SpecialPreferences',
96 'ResetTokens' => 'SpecialResetTokens',
97 'Contributions' => 'SpecialContributions',
98 'Listgrouprights' => 'SpecialListGroupRights',
99 'Listusers' => 'SpecialListUsers',
100 'Listadmins' => 'SpecialListAdmins',
101 'Listbots' => 'SpecialListBots',
102 'Userrights' => 'UserrightsPage',
103 'EditWatchlist' => 'SpecialEditWatchlist',
104
105 // Recent changes and logs
106 'Newimages' => 'SpecialNewFiles',
107 'Log' => 'SpecialLog',
108 'Watchlist' => 'SpecialWatchlist',
109 'Newpages' => 'SpecialNewpages',
110 'Recentchanges' => 'SpecialRecentChanges',
111 'Recentchangeslinked' => 'SpecialRecentChangesLinked',
112 'Tags' => 'SpecialTags',
113
114 // Media reports and uploads
115 'Listfiles' => 'SpecialListFiles',
116 'Filepath' => 'SpecialFilepath',
117 'MediaStatistics' => 'MediaStatisticsPage',
118 'MIMEsearch' => 'MIMEsearchPage',
119 'FileDuplicateSearch' => 'FileDuplicateSearchPage',
120 'Upload' => 'SpecialUpload',
121 'UploadStash' => 'SpecialUploadStash',
122 'ListDuplicatedFiles' => 'ListDuplicatedFilesPage',
123
124 // Data and tools
125 'Statistics' => 'SpecialStatistics',
126 'Allmessages' => 'SpecialAllMessages',
127 'Version' => 'SpecialVersion',
128 'Lockdb' => 'SpecialLockdb',
129 'Unlockdb' => 'SpecialUnlockdb',
130
131 // Redirecting special pages
132 'LinkSearch' => 'LinkSearchPage',
133 'Randompage' => 'RandomPage',
134 'RandomInCategory' => 'SpecialRandomInCategory',
135 'Randomredirect' => 'SpecialRandomredirect',
136
137 // High use pages
138 'Mostlinkedcategories' => 'MostlinkedCategoriesPage',
139 'Mostimages' => 'MostimagesPage',
140 'Mostinterwikis' => 'MostinterwikisPage',
141 'Mostlinked' => 'MostlinkedPage',
142 'Mostlinkedtemplates' => 'MostlinkedTemplatesPage',
143 'Mostcategories' => 'MostcategoriesPage',
144 'Mostrevisions' => 'MostrevisionsPage',
145
146 // Page tools
147 'ComparePages' => 'SpecialComparePages',
148 'Export' => 'SpecialExport',
149 'Import' => 'SpecialImport',
150 'Undelete' => 'SpecialUndelete',
151 'Whatlinkshere' => 'SpecialWhatLinksHere',
152 'MergeHistory' => 'SpecialMergeHistory',
153 'ExpandTemplates' => 'SpecialExpandTemplates',
154
155 // Other
156 'Booksources' => 'SpecialBookSources',
157
158 // Unlisted / redirects
159 'Blankpage' => 'SpecialBlankpage',
160 'Diff' => 'SpecialDiff',
161 'Emailuser' => 'SpecialEmailUser',
162 'Movepage' => 'MovePageForm',
163 'Mycontributions' => 'SpecialMycontributions',
164 'MyLanguage' => 'SpecialMyLanguage',
165 'Mypage' => 'SpecialMypage',
166 'Mytalk' => 'SpecialMytalk',
167 'Myuploads' => 'SpecialMyuploads',
168 'AllMyUploads' => 'SpecialAllMyUploads',
169 'PermanentLink' => 'SpecialPermanentLink',
170 'Redirect' => 'SpecialRedirect',
171 'Revisiondelete' => 'SpecialRevisionDelete',
172 'RunJobs' => 'SpecialRunJobs',
173 'Specialpages' => 'SpecialSpecialpages',
174 'Userlogout' => 'SpecialUserlogout',
175 );
176
177 private static $list;
178 private static $aliases;
179
180 /**
181 * Reset the internal list of special pages. Useful when changing $wgSpecialPages after
182 * the internal list has already been initialized, e.g. during testing.
183 */
184 public static function resetList() {
185 self::$list = null;
186 self::$aliases = null;
187 }
188
189 /**
190 * Returns a list of canonical special page names.
191 * May be used to iterate over all registered special pages.
192 *
193 * @return string[]
194 */
195 public static function getNames() {
196 return array_keys( self::getPageList() );
197 }
198
199 /**
200 * Get the special page list as an array
201 *
202 * @deprecated since 1.24, use getNames() instead.
203 * @return array
204 */
205 public static function getList() {
206 wfDeprecated( __FUNCTION__, '1.24' );
207 return self::getPageList();
208 }
209
210 /**
211 * Get the special page list as an array
212 *
213 * @return array
214 */
215 private static function getPageList() {
216 global $wgSpecialPages;
217 global $wgDisableCounters, $wgDisableInternalSearch, $wgEmailAuthentication;
218 global $wgEnableEmail, $wgEnableJavaScriptTest;
219 global $wgPageLanguageUseDB;
220
221 if ( !is_array( self::$list ) ) {
222 wfProfileIn( __METHOD__ );
223
224 self::$list = self::$coreList;
225
226 if ( !$wgDisableCounters ) {
227 self::$list['Popularpages'] = 'PopularPagesPage';
228 }
229
230 if ( !$wgDisableInternalSearch ) {
231 self::$list['Search'] = 'SpecialSearch';
232 }
233
234 if ( $wgEmailAuthentication ) {
235 self::$list['Confirmemail'] = 'EmailConfirmation';
236 self::$list['Invalidateemail'] = 'EmailInvalidation';
237 }
238
239 if ( $wgEnableEmail ) {
240 self::$list['ChangeEmail'] = 'SpecialChangeEmail';
241 }
242
243 if ( $wgEnableJavaScriptTest ) {
244 self::$list['JavaScriptTest'] = 'SpecialJavaScriptTest';
245 }
246
247 if ( $wgPageLanguageUseDB ) {
248 self::$list['PageLanguage'] = 'SpecialPageLanguage';
249 }
250
251 self::$list['Activeusers'] = 'SpecialActiveUsers';
252
253 // Add extension special pages
254 self::$list = array_merge( self::$list, $wgSpecialPages );
255
256 // Run hooks
257 // This hook can be used to remove undesired built-in special pages
258 wfRunHooks( 'SpecialPage_initList', array( &self::$list ) );
259
260 wfProfileOut( __METHOD__ );
261 }
262
263 return self::$list;
264 }
265
266 /**
267 * Initialise and return the list of special page aliases. Returns an object with
268 * properties which can be accessed $obj->pagename - each property name is an
269 * alias, with the value being the canonical name of the special page. All
270 * registered special pages are guaranteed to map to themselves.
271 * @return object
272 */
273 private static function getAliasListObject() {
274 if ( !is_object( self::$aliases ) ) {
275 global $wgContLang;
276 $aliases = $wgContLang->getSpecialPageAliases();
277 $pageList = self::getPageList();
278
279 self::$aliases = array();
280 $keepAlias = array();
281
282 // Force every canonical name to be an alias for itself.
283 foreach ( $pageList as $name => $stuff ) {
284 $caseFoldedAlias = $wgContLang->caseFold( $name );
285 self::$aliases[$caseFoldedAlias] = $name;
286 $keepAlias[$caseFoldedAlias] = 'canonical';
287 }
288
289 // Check for $aliases being an array since Language::getSpecialPageAliases can return null
290 if ( is_array( $aliases ) ) {
291 foreach ( $aliases as $realName => $aliasList ) {
292 $aliasList = array_values( $aliasList );
293 foreach ( $aliasList as $i => $alias ) {
294 $caseFoldedAlias = $wgContLang->caseFold( $alias );
295
296 if ( isset( self::$aliases[$caseFoldedAlias] ) &&
297 $realName === self::$aliases[$caseFoldedAlias]
298 ) {
299 // Ignore same-realName conflicts
300 continue;
301 }
302
303 if ( !isset( $keepAlias[$caseFoldedAlias] ) ) {
304 self::$aliases[$caseFoldedAlias] = $realName;
305 if ( !$i ) {
306 $keepAlias[$caseFoldedAlias] = 'first';
307 }
308 } elseif ( !$i ) {
309 wfWarn( "First alias '$alias' for $realName conflicts with " .
310 "{$keepAlias[$caseFoldedAlias]} alias for " .
311 self::$aliases[$caseFoldedAlias]
312 );
313 }
314 }
315 }
316 }
317
318 // Cast to object: func()[$key] doesn't work, but func()->$key does
319 self::$aliases = (object)self::$aliases;
320 }
321
322 return self::$aliases;
323 }
324
325 /**
326 * Given a special page name with a possible subpage, return an array
327 * where the first element is the special page name and the second is the
328 * subpage.
329 *
330 * @param string $alias
331 * @return array Array( String, String|null ), or array( null, null ) if the page is invalid
332 */
333 public static function resolveAlias( $alias ) {
334 global $wgContLang;
335 $bits = explode( '/', $alias, 2 );
336
337 $caseFoldedAlias = $wgContLang->caseFold( $bits[0] );
338 $caseFoldedAlias = str_replace( ' ', '_', $caseFoldedAlias );
339 if ( isset( self::getAliasListObject()->$caseFoldedAlias ) ) {
340 $name = self::getAliasListObject()->$caseFoldedAlias;
341 } else {
342 return array( null, null );
343 }
344
345 if ( !isset( $bits[1] ) ) { // bug 2087
346 $par = null;
347 } else {
348 $par = $bits[1];
349 }
350
351 return array( $name, $par );
352 }
353
354 /**
355 * Add a page to a certain display group for Special:SpecialPages
356 *
357 * @param SpecialPage|string $page
358 * @param string $group
359 * @deprecated since 1.21 Override SpecialPage::getGroupName
360 */
361 public static function setGroup( $page, $group ) {
362 wfDeprecated( __METHOD__, '1.21' );
363
364 global $wgSpecialPageGroups;
365 $name = is_object( $page ) ? $page->getName() : $page;
366 $wgSpecialPageGroups[$name] = $group;
367 }
368
369 /**
370 * Get the group that the special page belongs in on Special:SpecialPage
371 *
372 * @param SpecialPage $page
373 * @return string
374 * @deprecated since 1.21 Use SpecialPage::getFinalGroupName
375 */
376 public static function getGroup( &$page ) {
377 wfDeprecated( __METHOD__, '1.21' );
378
379 return $page->getFinalGroupName();
380 }
381
382 /**
383 * Check if a given name exist as a special page or as a special page alias
384 *
385 * @param string $name Name of a special page
386 * @return bool True if a special page exists with this name
387 */
388 public static function exists( $name ) {
389 list( $title, /*...*/ ) = self::resolveAlias( $name );
390
391 $specialPageList = self::getPageList();
392 return isset( $specialPageList[$title] );
393 }
394
395 /**
396 * Find the object with a given name and return it (or NULL)
397 *
398 * @param string $name Special page name, may be localised and/or an alias
399 * @return SpecialPage|null SpecialPage object or null if the page doesn't exist
400 */
401 public static function getPage( $name ) {
402 list( $realName, /*...*/ ) = self::resolveAlias( $name );
403
404 $specialPageList = self::getPageList();
405
406 if ( isset( $specialPageList[$realName] ) ) {
407 $rec = $specialPageList[$realName];
408
409 if ( is_callable( $rec ) ) {
410 // Use callback to instantiate the special page
411 $page = call_user_func( $rec );
412 } elseif ( is_string( $rec ) ) {
413 $className = $rec;
414 $page = new $className;
415 } elseif ( is_array( $rec ) ) {
416 $className = array_shift( $rec );
417 // @deprecated, officially since 1.18, unofficially since forever
418 wfDeprecated( "Array syntax for \$wgSpecialPages is deprecated ($className), " .
419 "define a subclass of SpecialPage instead.", '1.18' );
420 $page = MWFunction::newObj( $className, $rec );
421 } elseif ( $rec instanceof SpecialPage ) {
422 $page = $rec; //XXX: we should deep clone here
423 } else {
424 $page = null;
425 }
426
427 if ( $page instanceof SpecialPage ) {
428 return $page;
429 } else {
430 // It's not a classname, nor a callback, nor a legacy constructor array,
431 // nor a special page object. Give up.
432 wfLogWarning( "Cannot instantiate special page $realName: bad spec!" );
433 return null;
434 }
435
436 } else {
437 return null;
438 }
439 }
440
441 /**
442 * Return categorised listable special pages which are available
443 * for the current user, and everyone.
444 *
445 * @param User $user User object to check permissions, $wgUser will be used
446 * if not provided
447 * @return array ( string => Specialpage )
448 */
449 public static function getUsablePages( User $user = null ) {
450 $pages = array();
451 if ( $user === null ) {
452 global $wgUser;
453 $user = $wgUser;
454 }
455 foreach ( self::getPageList() as $name => $rec ) {
456 $page = self::getPage( $name );
457 if ( $page ) { // not null
458 $page->setContext( RequestContext::getMain() );
459 if ( $page->isListed()
460 && ( !$page->isRestricted() || $page->userCanExecute( $user ) )
461 ) {
462 $pages[$name] = $page;
463 }
464 }
465 }
466
467 return $pages;
468 }
469
470 /**
471 * Return categorised listable special pages for all users
472 *
473 * @return array ( string => Specialpage )
474 */
475 public static function getRegularPages() {
476 $pages = array();
477 foreach ( self::getPageList() as $name => $rec ) {
478 $page = self::getPage( $name );
479 if ( $page->isListed() && !$page->isRestricted() ) {
480 $pages[$name] = $page;
481 }
482 }
483
484 return $pages;
485 }
486
487 /**
488 * Return categorised listable special pages which are available
489 * for the current user, but not for everyone
490 *
491 * @param User|null $user User object to use or null for $wgUser
492 * @return array ( string => Specialpage )
493 */
494 public static function getRestrictedPages( User $user = null ) {
495 $pages = array();
496 if ( $user === null ) {
497 global $wgUser;
498 $user = $wgUser;
499 }
500 foreach ( self::getPageList() as $name => $rec ) {
501 $page = self::getPage( $name );
502 if (
503 $page->isListed()
504 && $page->isRestricted()
505 && $page->userCanExecute( $user )
506 ) {
507 $pages[$name] = $page;
508 }
509 }
510
511 return $pages;
512 }
513
514 /**
515 * Execute a special page path.
516 * The path may contain parameters, e.g. Special:Name/Params
517 * Extracts the special page name and call the execute method, passing the parameters
518 *
519 * Returns a title object if the page is redirected, false if there was no such special
520 * page, and true if it was successful.
521 *
522 * @param Title $title
523 * @param IContextSource $context
524 * @param bool $including Bool output is being captured for use in {{special:whatever}}
525 *
526 * @return bool
527 */
528 public static function executePath( Title &$title, IContextSource &$context, $including = false ) {
529 wfProfileIn( __METHOD__ );
530
531 // @todo FIXME: Redirects broken due to this call
532 $bits = explode( '/', $title->getDBkey(), 2 );
533 $name = $bits[0];
534 if ( !isset( $bits[1] ) ) { // bug 2087
535 $par = null;
536 } else {
537 $par = $bits[1];
538 }
539 $page = self::getPage( $name );
540 // Nonexistent?
541 if ( !$page ) {
542 $context->getOutput()->setArticleRelated( false );
543 $context->getOutput()->setRobotPolicy( 'noindex,nofollow' );
544
545 global $wgSend404Code;
546 if ( $wgSend404Code ) {
547 $context->getOutput()->setStatusCode( 404 );
548 }
549
550 $context->getOutput()->showErrorPage( 'nosuchspecialpage', 'nospecialpagetext' );
551 wfProfileOut( __METHOD__ );
552
553 return false;
554 }
555
556 // Page exists, set the context
557 $page->setContext( $context );
558
559 if ( !$including ) {
560 // Redirect to canonical alias for GET commands
561 // Not for POST, we'd lose the post data, so it's best to just distribute
562 // the request. Such POST requests are possible for old extensions that
563 // generate self-links without being aware that their default name has
564 // changed.
565 if ( $name != $page->getLocalName() && !$context->getRequest()->wasPosted() ) {
566 $query = $context->getRequest()->getQueryValues();
567 unset( $query['title'] );
568 $title = $page->getPageTitle( $par );
569 $url = $title->getFullURL( $query );
570 $context->getOutput()->redirect( $url );
571 wfProfileOut( __METHOD__ );
572
573 return $title;
574 } else {
575 $context->setTitle( $page->getPageTitle( $par ) );
576 }
577 } elseif ( !$page->isIncludable() ) {
578 wfProfileOut( __METHOD__ );
579
580 return false;
581 }
582
583 $page->including( $including );
584
585 // Execute special page
586 $profName = 'Special:' . $page->getName();
587 wfProfileIn( $profName );
588 $page->run( $par );
589 wfProfileOut( $profName );
590 wfProfileOut( __METHOD__ );
591
592 return true;
593 }
594
595 /**
596 * Just like executePath() but will override global variables and execute
597 * the page in "inclusion" mode. Returns true if the execution was
598 * successful or false if there was no such special page, or a title object
599 * if it was a redirect.
600 *
601 * Also saves the current $wgTitle, $wgOut, $wgRequest, $wgUser and $wgLang
602 * variables so that the special page will get the context it'd expect on a
603 * normal request, and then restores them to their previous values after.
604 *
605 * @param Title $title
606 * @param IContextSource $context
607 * @return string HTML fragment
608 */
609 public static function capturePath( Title $title, IContextSource $context ) {
610 global $wgOut, $wgTitle, $wgRequest, $wgUser, $wgLang;
611
612 // Save current globals
613 $oldTitle = $wgTitle;
614 $oldOut = $wgOut;
615 $oldRequest = $wgRequest;
616 $oldUser = $wgUser;
617 $oldLang = $wgLang;
618
619 // Set the globals to the current context
620 $wgTitle = $title;
621 $wgOut = $context->getOutput();
622 $wgRequest = $context->getRequest();
623 $wgUser = $context->getUser();
624 $wgLang = $context->getLanguage();
625
626 // The useful part
627 $ret = self::executePath( $title, $context, true );
628
629 // And restore the old globals
630 $wgTitle = $oldTitle;
631 $wgOut = $oldOut;
632 $wgRequest = $oldRequest;
633 $wgUser = $oldUser;
634 $wgLang = $oldLang;
635
636 return $ret;
637 }
638
639 /**
640 * Get the local name for a specified canonical name
641 *
642 * @param string $name
643 * @param string|bool $subpage
644 * @return string
645 */
646 public static function getLocalNameFor( $name, $subpage = false ) {
647 global $wgContLang;
648 $aliases = $wgContLang->getSpecialPageAliases();
649 $aliasList = self::getAliasListObject();
650
651 // Find the first alias that maps back to $name
652 if ( isset( $aliases[$name] ) ) {
653 $found = false;
654 foreach ( $aliases[$name] as $alias ) {
655 $caseFoldedAlias = $wgContLang->caseFold( $alias );
656 $caseFoldedAlias = str_replace( ' ', '_', $caseFoldedAlias );
657 if ( isset( $aliasList->$caseFoldedAlias ) &&
658 $aliasList->$caseFoldedAlias === $name
659 ) {
660 $name = $alias;
661 $found = true;
662 break;
663 }
664 }
665 if ( !$found ) {
666 wfWarn( "Did not find a usable alias for special page '$name'. " .
667 "It seems all defined aliases conflict?" );
668 }
669 } else {
670 // Check if someone misspelled the correct casing
671 if ( is_array( $aliases ) ) {
672 foreach ( $aliases as $n => $values ) {
673 if ( strcasecmp( $name, $n ) === 0 ) {
674 wfWarn( "Found alias defined for $n when searching for " .
675 "special page aliases for $name. Case mismatch?" );
676 return self::getLocalNameFor( $n, $subpage );
677 }
678 }
679 }
680
681 wfWarn( "Did not find alias for special page '$name'. " .
682 "Perhaps no aliases are defined for it?" );
683 }
684
685 if ( $subpage !== false && !is_null( $subpage ) ) {
686 $name = "$name/$subpage";
687 }
688
689 return $wgContLang->ucfirst( $name );
690 }
691
692 /**
693 * Get a title for a given alias
694 *
695 * @param string $alias
696 * @return Title|null Title or null if there is no such alias
697 */
698 public static function getTitleForAlias( $alias ) {
699 list( $name, $subpage ) = self::resolveAlias( $alias );
700 if ( $name != null ) {
701 return SpecialPage::getTitleFor( $name, $subpage );
702 } else {
703 return null;
704 }
705 }
706 }