diff options
Diffstat (limited to 'includes/SpecialPageFactory.php')
-rw-r--r-- | includes/SpecialPageFactory.php | 66 |
1 files changed, 30 insertions, 36 deletions
diff --git a/includes/SpecialPageFactory.php b/includes/SpecialPageFactory.php index 95f75a8e..11edc8ac 100644 --- a/includes/SpecialPageFactory.php +++ b/includes/SpecialPageFactory.php @@ -78,8 +78,8 @@ class SpecialPageFactory { 'Allpages' => 'SpecialAllpages', 'Prefixindex' => 'SpecialPrefixindex', 'Categories' => 'SpecialCategories', - 'Disambiguations' => 'DisambiguationsPage', 'Listredirects' => 'ListredirectsPage', + 'PagesWithProp' => 'SpecialPagesWithProp', // Login/create account 'Userlogin' => 'LoginForm', @@ -93,9 +93,10 @@ class SpecialPageFactory { 'PasswordReset' => 'SpecialPasswordReset', 'DeletedContributions' => 'DeletedContributionsPage', 'Preferences' => 'SpecialPreferences', + 'ResetTokens' => 'SpecialResetTokens', 'Contributions' => 'SpecialContributions', 'Listgrouprights' => 'SpecialListGroupRights', - 'Listusers' => 'SpecialListUsers' , + 'Listusers' => 'SpecialListUsers', 'Listadmins' => 'SpecialListAdmins', 'Listbots' => 'SpecialListBots', 'Activeusers' => 'SpecialActiveUsers', @@ -119,7 +120,7 @@ class SpecialPageFactory { 'Upload' => 'SpecialUpload', 'UploadStash' => 'SpecialUploadStash', - // Wiki data and tools + // Data and tools 'Statistics' => 'SpecialStatistics', 'Allmessages' => 'SpecialAllmessages', 'Version' => 'SpecialVersion', @@ -129,6 +130,7 @@ class SpecialPageFactory { // Redirecting special pages 'LinkSearch' => 'LinkSearchPage', 'Randompage' => 'Randompage', + 'RandomInCategory' => 'SpecialRandomInCategory', 'Randomredirect' => 'SpecialRandomredirect', // High use pages @@ -153,15 +155,15 @@ class SpecialPageFactory { // Unlisted / redirects 'Blankpage' => 'SpecialBlankpage', - 'Blockme' => 'SpecialBlockme', 'Emailuser' => 'SpecialEmailUser', - 'JavaScriptTest' => 'SpecialJavaScriptTest', 'Movepage' => 'MovePageForm', 'Mycontributions' => 'SpecialMycontributions', 'Mypage' => 'SpecialMypage', 'Mytalk' => 'SpecialMytalk', 'Myuploads' => 'SpecialMyuploads', + 'AllMyUploads' => 'SpecialAllMyUploads', 'PermanentLink' => 'SpecialPermanentLink', + 'Redirect' => 'SpecialRedirect', 'Revisiondelete' => 'SpecialRevisionDelete', 'Specialpages' => 'SpecialSpecialpages', 'Userlogout' => 'SpecialUserlogout', @@ -178,7 +180,7 @@ class SpecialPageFactory { static function getList() { global $wgSpecialPages; global $wgDisableCounters, $wgDisableInternalSearch, $wgEmailAuthentication; - global $wgEnableEmail; + global $wgEnableEmail, $wgEnableJavaScriptTest; if ( !is_object( self::$mList ) ) { wfProfileIn( __METHOD__ ); @@ -200,6 +202,10 @@ class SpecialPageFactory { self::$mList['ChangeEmail'] = 'SpecialChangeEmail'; } + if ( $wgEnableJavaScriptTest ) { + self::$mList['JavaScriptTest'] = 'SpecialJavaScriptTest'; + } + // Add extension special pages self::$mList = array_merge( self::$mList, $wgSpecialPages ); @@ -218,7 +224,7 @@ class SpecialPageFactory { /** * Initialise and return the list of special page aliases. Returns an object with * properties which can be accessed $obj->pagename - each property is an array of - * aliases; the first in the array is the cannonical alias. All registered special + * aliases; the first in the array is the canonical alias. All registered special * pages are guaranteed to have a property entry, and for that property array to * contain at least one entry (English fallbacks will be added if necessary). * @return Object @@ -282,8 +288,11 @@ class SpecialPageFactory { * * @param $page Mixed: SpecialPage or string * @param $group String + * @deprecated since 1.21 Override SpecialPage::getGroupName */ public static function setGroup( $page, $group ) { + wfDeprecated( __METHOD__, '1.21' ); + global $wgSpecialPageGroups; $name = is_object( $page ) ? $page->getName() : $page; $wgSpecialPageGroups[$name] = $group; @@ -294,34 +303,18 @@ class SpecialPageFactory { * * @param $page SpecialPage * @return String + * @deprecated since 1.21 Use SpecialPage::getFinalGroupName */ public static function getGroup( &$page ) { - $name = $page->getName(); + wfDeprecated( __METHOD__, '1.21' ); - global $wgSpecialPageGroups; - static $specialPageGroupsCache = array(); - if ( isset( $specialPageGroupsCache[$name] ) ) { - return $specialPageGroupsCache[$name]; - } - $msg = wfMessage( 'specialpages-specialpagegroup-' . strtolower( $name ) ); - if ( !$msg->isBlank() ) { - $group = $msg->text(); - } else { - $group = isset( $wgSpecialPageGroups[$name] ) - ? $wgSpecialPageGroups[$name] - : '-'; - } - if ( $group == '-' ) { - $group = 'other'; - } - $specialPageGroupsCache[$name] = $group; - return $group; + return $page->getFinalGroupName(); } /** * Check if a given name exist as a special page or as a special page alias * - * @param $name String: name of a special page + * @param string $name name of a special page * @return Boolean: true if a special page exists with this name */ public static function exists( $name ) { @@ -332,8 +325,8 @@ class SpecialPageFactory { /** * Find the object with a given name and return it (or NULL) * - * @param $name String Special page name, may be localised and/or an alias - * @return SpecialPage object or null if the page doesn't exist + * @param string $name Special page name, may be localised and/or an alias + * @return SpecialPage|null SpecialPage object or null if the page doesn't exist */ public static function getPage( $name ) { list( $realName, /*...*/ ) = self::resolveAlias( $name ); @@ -370,11 +363,13 @@ class SpecialPageFactory { } foreach ( self::getList() as $name => $rec ) { $page = self::getPage( $name ); - if ( $page // not null - && $page->isListed() - && ( !$page->isRestricted() || $page->userCanExecute( $user ) ) - ) { - $pages[$name] = $page; + if ( $page ) { // not null + $page->setContext( RequestContext::getMain() ); + if ( $page->isListed() + && ( !$page->isRestricted() || $page->userCanExecute( $user ) ) + ) { + $pages[$name] = $page; + } } } return $pages; @@ -471,9 +466,8 @@ class SpecialPageFactory { if ( $name != $page->getLocalName() && !$context->getRequest()->wasPosted() ) { $query = $context->getRequest()->getQueryValues(); unset( $query['title'] ); - $query = wfArrayToCGI( $query ); $title = $page->getTitle( $par ); - $url = $title->getFullUrl( $query ); + $url = $title->getFullURL( $query ); $context->getOutput()->redirect( $url ); wfProfileOut( __METHOD__ ); return $title; |