Follow up r71459
[lhc/web/wiklou.git] / includes / SpecialPage.php
index c452b17..35890dc 100644 (file)
@@ -92,8 +92,8 @@ class SpecialPage {
                'Lonelypages'               => array( 'SpecialPage', 'Lonelypages' ),
                'Fewestrevisions'           => array( 'SpecialPage', 'Fewestrevisions' ),
                'Withoutinterwiki'          => array( 'SpecialPage', 'Withoutinterwiki' ),
-               'Protectedpages'            => array( 'SpecialPage', 'Protectedpages' ),
-               'Protectedtitles'           => array( 'SpecialPage', 'Protectedtitles' ),
+               'Protectedpages'            => 'SpecialProtectedpages',
+               'Protectedtitles'           => 'SpecialProtectedtitles',
                'Shortpages'                => array( 'SpecialPage', 'Shortpages' ),
                'Uncategorizedcategories'   => array( 'SpecialPage', 'Uncategorizedcategories' ),
                'Uncategorizedimages'       => array( 'SpecialPage', 'Uncategorizedimages' ),
@@ -111,7 +111,7 @@ class SpecialPage {
                # List of pages
                'Allpages'                  => 'SpecialAllpages',
                'Prefixindex'               => 'SpecialPrefixindex',
-               'Categories'                => array( 'SpecialPage', 'Categories' ),
+               'Categories'                => 'SpecialCategories',
                'Disambiguations'           => array( 'SpecialPage', 'Disambiguations' ),
                'Listredirects'             => array( 'SpecialPage', 'Listredirects' ),
 
@@ -120,8 +120,8 @@ class SpecialPage {
                'CreateAccount'             => array( 'SpecialRedirectToSpecial', 'CreateAccount', 'Userlogin', 'signup', array( 'uselang' ) ),
 
                # Users and rights
-               'Blockip'                   => array( 'SpecialPage', 'Blockip', 'block' ),
-               'Ipblocklist'               => array( 'SpecialPage', 'Ipblocklist' ),
+               'Blockip'                   => 'IPBlockForm',
+               'Ipblocklist'               => 'IPUnblockForm',
                'Unblock'                   => array( 'SpecialRedirectToSpecial', 'Unblock', 'Ipblocklist', false, array( 'uselang', 'ip', 'id' ), array( 'action' => 'unblock' ) ),
                'Resetpass'                 => 'SpecialResetpass',
                'DeletedContributions'      => 'DeletedContributionsPage',
@@ -129,12 +129,14 @@ class SpecialPage {
                'Contributions'             => 'SpecialContributions',
                'Listgrouprights'           => 'SpecialListGroupRights',
                'Listusers'                 => array( 'SpecialPage', 'Listusers' ),
+               'Listadmins'                => array( 'SpecialRedirectToSpecial', 'Listadmins', 'Listusers', 'sysop' ),
+               'Listbots'                  => array( 'SpecialRedirectToSpecial', 'Listbots', 'Listusers', 'bot' ),
                'Activeusers'               => 'SpecialActiveUsers',
                'Userrights'                => 'UserrightsPage',
 
                # Recent changes and logs
                'Newimages'                 => array( 'IncludableSpecialPage', 'Newimages' ),
-               'Log'                       => array( 'SpecialPage', 'Log' ),
+               'Log'                       => 'SpecialLog',
                'Watchlist'                 => array( 'SpecialPage', 'Watchlist' ),
                'Newpages'                  => 'SpecialNewpages',
                'Recentchanges'             => 'SpecialRecentchanges',
@@ -143,17 +145,18 @@ class SpecialPage {
 
                # Media reports and uploads
                'Listfiles'                 => array( 'SpecialPage', 'Listfiles' ),
-               'Filepath'                  => array( 'SpecialPage', 'Filepath' ),
+               'Filepath'                  => 'SpecialFilepath',
                'MIMEsearch'                => array( 'SpecialPage', 'MIMEsearch' ),
                'FileDuplicateSearch'       => array( 'SpecialPage', 'FileDuplicateSearch' ),
                'Upload'                    => 'SpecialUpload',
+               'UploadStash'        => 'SpecialUploadStash',
 
                # Wiki data and tools
                'Statistics'                => 'SpecialStatistics',
                'Allmessages'               => 'SpecialAllmessages',
                'Version'                   => 'SpecialVersion',
-               'Lockdb'                    => array( 'SpecialPage', 'Lockdb', 'siteadmin' ),
-               'Unlockdb'                  => array( 'SpecialPage', 'Unlockdb', 'siteadmin' ),
+               'Lockdb'                    => 'SpecialLockdb',
+               'Unlockdb'                  => 'SpecialUnlockdb',
 
                # Redirecting special pages
                'LinkSearch'                => array( 'SpecialPage', 'LinkSearch' ),
@@ -169,9 +172,10 @@ class SpecialPage {
                'Mostrevisions'             => array( 'SpecialPage', 'Mostrevisions' ),
 
                # Page tools
+               'ComparePages'              => 'SpecialComparePages',
                'Export'                    => 'SpecialExport',
                'Import'                    => 'SpecialImport',
-               'Undelete'                  => array( 'SpecialPage', 'Undelete', 'deletedhistory' ),
+               'Undelete'                  => 'UndeleteForm',
                'Whatlinkshere'             => 'SpecialWhatlinkshere',
                'MergeHistory'              => 'SpecialMergeHistory',
 
@@ -180,18 +184,16 @@ class SpecialPage {
 
                # Unlisted / redirects
                'Blankpage'                 => 'SpecialBlankpage',
-               'Blockme'                   => array( 'UnlistedSpecialPage', 'Blockme' ),
+               'Blockme'                   => 'SpecialBlockme',
                'Emailuser'                 => 'SpecialEmailUser',
-               'Listadmins'                => array( 'SpecialRedirectToSpecial', 'Listadmins', 'Listusers', 'sysop' ),
-               'Listbots'                  => array( 'SpecialRedirectToSpecial', 'Listbots', 'Listusers', 'bot' ),
-               'Movepage'                  => array( 'UnlistedSpecialPage', 'Movepage' ),
-               'Mycontributions'           => array( 'SpecialMycontributions' ),
-               'Mypage'                    => array( 'SpecialMypage' ),
-               'Mytalk'                    => array( 'SpecialMytalk' ),
+               'Movepage'                  => 'MovePageForm',
+               'Mycontributions'           => 'SpecialMycontributions',
+               'Mypage'                    => 'SpecialMypage',
+               'Mytalk'                    => 'SpecialMytalk',
                'Revisiondelete'            => 'SpecialRevisionDelete',
                'RevisionMove'              => 'SpecialRevisionMove',
-               'Specialpages'              => array( 'UnlistedSpecialPage', 'Specialpages' ),
-               'Userlogout'                => array( 'UnlistedSpecialPage', 'Userlogout' ),
+               'Specialpages'              => 'SpecialSpecialpages',
+               'Userlogout'                => 'SpecialUserlogout',
        );
 
        static public $mAliases;
@@ -270,6 +272,7 @@ class SpecialPage {
                if ( !self::$mListInitialised ) self::initList();
                if ( is_null( self::$mAliases ) ) self::initAliasList();
                $caseFoldedAlias = $wgContLang->caseFold( $alias );
+               $caseFoldedAlias = str_replace( ' ', '_', $caseFoldedAlias );
                if ( isset( self::$mAliases[$caseFoldedAlias] ) ) {
                        return self::$mAliases[$caseFoldedAlias];
                } else {
@@ -302,8 +305,10 @@ class SpecialPage {
         * an associative record to $wgSpecialPages. This avoids autoloading SpecialPage.
         *
         * @param $page SpecialPage
+        * Deprecated in 1.7, warnings in 1.17, might be removed in 1.20
         */
        static function addPage( &$page ) {
+               wfDeprecated( __METHOD__ );
                if ( !self::$mListInitialised ) {
                        self::initList();
                }
@@ -568,7 +573,7 @@ class SpecialPage {
                $page->including( $including );
 
                // Execute special page
-               $profName = 'Special:' . $page->getName();
+               $profName = 'Special:' . $page->name();
                wfProfileIn( $profName );
                $page->execute( $par );
                wfProfileOut( $profName );
@@ -618,15 +623,17 @@ class SpecialPage {
                        $found = false;
                        foreach ( $aliases as $n => $values ) {
                                if ( strcasecmp( $name, $n ) === 0 ) {
-                                       wfWarn( "Found alias defined for $n when searching for special page aliases
-for $name. Case mismatch?" );
+                                       wfWarn( "Found alias defined for $n when searching for" .
+                                               "special page aliases for $name. Case mismatch?" );
                                        $name = $values[0];
                                        $found = true;
                                        break;
                                }
                        }
-                       if ( !$found ) wfWarn( "Did not find alias for special page '$name'.
-Perhaps no page aliases are defined for it?" );
+                       if ( !$found ) {
+                               wfWarn( "Did not find alias for special page '$name'. " . 
+                                       "Perhaps no aliases are defined for it?" );
+                       }
                }
                if ( $subpage !== false && !is_null( $subpage ) ) {
                        $name = "$name/$subpage";
@@ -693,7 +700,7 @@ Perhaps no page aliases are defined for it?" );
         * @param $file String: file which is included by execute(). It is also constructed from $name by default
         * @param $includable Boolean: whether the page can be included in normal pages
         */
-       function SpecialPage( $name = '', $restriction = '', $listed = true, $function = false, $file = 'default', $includable = false ) {
+       function __construct( $name = '', $restriction = '', $listed = true, $function = false, $file = 'default', $includable = false ) {
                $this->mName = $name;
                $this->mRestriction = $restriction;
                $this->mListed = $listed;
@@ -904,8 +911,8 @@ Perhaps no page aliases are defined for it?" );
  */
 class UnlistedSpecialPage extends SpecialPage
 {
-       function UnlistedSpecialPage( $name, $restriction = '', $function = false, $file = 'default' ) {
-               SpecialPage::SpecialPage( $name, $restriction, false, $function, $file );
+       function __construct( $name, $restriction = '', $function = false, $file = 'default' ) {
+               parent::__construct( $name, $restriction, false, $function, $file );
        }
 }
 
@@ -915,8 +922,8 @@ class UnlistedSpecialPage extends SpecialPage
  */
 class IncludableSpecialPage extends SpecialPage
 {
-       function IncludableSpecialPage( $name, $restriction = '', $listed = true, $function = false, $file = 'default' ) {
-               SpecialPage::SpecialPage( $name, $restriction, $listed, $function, $file, true );
+       function __construct( $name, $restriction = '', $listed = true, $function = false, $file = 'default' ) {
+               parent::__construct( $name, $restriction, $listed, $function, $file, true );
        }
 }
 
@@ -958,7 +965,8 @@ class SpecialRedirectToSpecial extends UnlistedSpecialPage {
 class SpecialMypage extends UnlistedSpecialPage {
        function __construct() {
                parent::__construct( 'Mypage' );
-               $this->mAllowedRedirectParams = array( 'action' , 'preload' , 'editintro', 'section' );
+               $this->mAllowedRedirectParams = array( 'action' , 'preload' , 'editintro',
+                       'section', 'oldid', 'diff', 'dir' );
        }
 
        function getRedirect( $subpage ) {
@@ -978,7 +986,8 @@ class SpecialMypage extends UnlistedSpecialPage {
 class SpecialMytalk extends UnlistedSpecialPage {
        function __construct() {
                parent::__construct( 'Mytalk' );
-               $this->mAllowedRedirectParams = array( 'action' , 'preload' , 'editintro', 'section' );
+               $this->mAllowedRedirectParams = array( 'action' , 'preload' , 'editintro',
+                       'section', 'oldid', 'diff', 'dir' );
        }
 
        function getRedirect( $subpage ) {