Index: trunk/phase3/includes/SpecialPage.php |
— | — | @@ -80,13 +80,7 @@ |
81 | 81 | protected $mContext; |
82 | 82 | |
83 | 83 | /** |
84 | | - * List of special pages, followed by parameters. |
85 | | - * If the only parameter is a string, that is the page name. |
86 | | - * Otherwise, it is an array. The format is one of: |
87 | | - ** array( 'SpecialPage', name, right ) |
88 | | - ** array( 'IncludableSpecialPage', name, right, listed? ) |
89 | | - ** array( 'UnlistedSpecialPage', name, right ) |
90 | | - ** array( 'SpecialRedirectToSpecial', name, page to redirect to, special page param, ... ) |
| 84 | + * List of special page names to the subclass of SpecialPage which handles them. |
91 | 85 | */ |
92 | 86 | static public $mList = array( |
93 | 87 | # Maintenance Reports |
— | — | @@ -123,7 +117,7 @@ |
124 | 118 | |
125 | 119 | # Login/create account |
126 | 120 | 'Userlogin' => 'LoginForm', |
127 | | - 'CreateAccount' => array( 'SpecialRedirectToSpecial', 'CreateAccount', 'Userlogin', 'signup', array( 'uselang' ) ), |
| 121 | + 'CreateAccount' => 'SpecialCreateAccount', |
128 | 122 | |
129 | 123 | # Users and rights |
130 | 124 | 'Block' => 'SpecialBlock', |
— | — | @@ -135,8 +129,8 @@ |
136 | 130 | 'Contributions' => 'SpecialContributions', |
137 | 131 | 'Listgrouprights' => 'SpecialListGroupRights', |
138 | 132 | 'Listusers' => 'SpecialListUsers' , |
139 | | - 'Listadmins' => array( 'SpecialRedirectToSpecial', 'Listadmins', 'Listusers', 'sysop' ), |
140 | | - 'Listbots' => array( 'SpecialRedirectToSpecial', 'Listbots', 'Listusers', 'bot' ), |
| 133 | + 'Listadmins' => 'SpecialListAdmins', |
| 134 | + 'Listbots' => 'SpecialListBots', |
141 | 135 | 'Activeusers' => 'SpecialActiveUsers', |
142 | 136 | 'Userrights' => 'UserrightsPage', |
143 | 137 | 'DisableAccount' => 'SpecialDisableAccount', |
— | — | @@ -414,6 +408,8 @@ |
415 | 409 | $className = $rec; |
416 | 410 | self::$mList[$name] = new $className; |
417 | 411 | } elseif ( is_array( $rec ) ) { |
| 412 | + // @deprecated officially since 1.18, unofficially since forever |
| 413 | + wfDebug( "Array syntax for \$wgSpecialPages is deprecated, define a subclass of SpecialPage instead." ); |
418 | 414 | $className = array_shift( $rec ); |
419 | 415 | self::$mList[$name] = MWFunction::newObj( $className, $rec ); |
420 | 416 | } |
— | — | @@ -752,13 +748,14 @@ |
753 | 749 | * |
754 | 750 | * @param $fName String Name of called method |
755 | 751 | * @param $a Array Arguments to the method |
756 | | - * @deprecated Call isn't deprecated, but SpecialPage::SpecialPage() is |
| 752 | + * @deprecated since 1.17, call parent::__construct() |
757 | 753 | */ |
758 | 754 | public function __call( $fName, $a ) { |
759 | 755 | // Sometimes $fName is SpecialPage, sometimes it's specialpage. <3 PHP |
760 | 756 | if( strtolower( $fName ) == 'specialpage' ) { |
761 | | - // Debug messages now, warnings in 1.19 or 1.20? |
762 | | - wfDebug( "Deprecated SpecialPage::SpecialPage() called, use __construct();\n" ); |
| 757 | + // Deprecated messages now, remove in 1.19 or 1.20? |
| 758 | + wfDeprecated( __METHOD__ ); |
| 759 | + |
763 | 760 | $name = isset( $a[0] ) ? $a[0] : ''; |
764 | 761 | $restriction = isset( $a[1] ) ? $a[1] : ''; |
765 | 762 | $listed = isset( $a[2] ) ? $a[2] : true; |
— | — | @@ -1082,7 +1079,7 @@ |
1083 | 1080 | * Shortcut to construct a special page alias. |
1084 | 1081 | * @ingroup SpecialPage |
1085 | 1082 | */ |
1086 | | -class SpecialRedirectToSpecial extends UnlistedSpecialPage { |
| 1083 | +abstract class SpecialRedirectToSpecial extends UnlistedSpecialPage { |
1087 | 1084 | var $redirName, $redirSubpage; |
1088 | 1085 | |
1089 | 1086 | function __construct( $name, $redirName, $redirSubpage = false, $allowedRedirectParams = array(), $addedRedirectParams = array() ) { |
— | — | @@ -1103,6 +1100,33 @@ |
1104 | 1101 | } |
1105 | 1102 | |
1106 | 1103 | /** |
| 1104 | + * ListAdmins --> ListUsers/admin |
| 1105 | + */ |
| 1106 | +class SpecialListAdmins extends SpecialRedirectToSpecial { |
| 1107 | + function __construct(){ |
| 1108 | + parent::__construct( 'ListAdmins', 'ListUsers', 'sysop' ); |
| 1109 | + } |
| 1110 | +} |
| 1111 | + |
| 1112 | +/** |
| 1113 | + * ListBots --> ListUsers/admin |
| 1114 | + */ |
| 1115 | +class SpecialListBots extends SpecialRedirectToSpecial { |
| 1116 | + function __construct(){ |
| 1117 | + parent::__construct( 'ListAdmins', 'ListUsers', 'bot' ); |
| 1118 | + } |
| 1119 | +} |
| 1120 | + |
| 1121 | +/** |
| 1122 | + * CreateAccount --> UserLogin/signup |
| 1123 | + * FIXME: this (and the rest of the login frontend) needs to die a horrible painful death |
| 1124 | + */ |
| 1125 | +class SpecialCreateAccount extends SpecialRedirectToSpecial { |
| 1126 | + function __construct(){ |
| 1127 | + parent::__construct( 'CreateAccount', 'Userlogin', 'signup', array( 'uselang' ) ); |
| 1128 | + } |
| 1129 | +} |
| 1130 | +/** |
1107 | 1131 | * SpecialMypage, SpecialMytalk and SpecialMycontributions special pages |
1108 | 1132 | * are used to get user independant links pointing to the user page, talk |
1109 | 1133 | * page and list of contributions. |
Index: trunk/extensions/OpenID/OpenID.hooks.php |
— | — | @@ -1,13 +1,28 @@ |
2 | 2 | <?php |
3 | 3 | |
| 4 | +/** |
| 5 | + * Redirect classes to hijack the core UserLogin and CreateAccount facilities, because |
| 6 | + * they're so badly written as to be impossible to extend |
| 7 | + */ |
| 8 | +class SpecialOpenIDCreateAccount extends SpecialRedirectToSpecial { |
| 9 | + function __construct(){ |
| 10 | + parent::__construct( 'SpecialOpenIDCreateAccount', 'OpenIDLogin' ); |
| 11 | + } |
| 12 | +} |
| 13 | +class SpecialOpenIDUserLogin extends SpecialRedirectToSpecial { |
| 14 | + function __construct(){ |
| 15 | + parent::__construct( 'SpecialOpenIDUserLogin', 'OpenIDLogin', false, array( 'returnto', 'returntoquery' ) ); |
| 16 | + } |
| 17 | +} |
| 18 | + |
4 | 19 | class OpenIDHooks { |
5 | 20 | public static function onSpecialPage_initList( &$list ) { |
6 | 21 | global $wgOpenIDOnly, $wgOpenIDClientOnly; |
7 | 22 | |
8 | 23 | if ( $wgOpenIDOnly ) { |
9 | | - $list['Userlogin'] = array( 'SpecialRedirectToSpecial', 'Userlogin', 'OpenIDLogin', false, array( 'returnto', 'returntoquery' ) ); |
| 24 | + $list['Userlogin'] = 'SpecialOpenIDUserLogin'; |
10 | 25 | # Used in 1.12.x and above |
11 | | - $list['CreateAccount'] = array( 'SpecialRedirectToSpecial', 'CreateAccount', 'OpenIDLogin' ); |
| 26 | + $list['CreateAccount'] = 'SpecialOpenIDCreateAccount'; |
12 | 27 | } |
13 | 28 | |
14 | 29 | # Special pages are added at global scope; remove server-related ones |
Index: trunk/extensions/MetavidWiki/includes/specials/MV_SpecialMediaSearch.php |
— | — | @@ -37,7 +37,7 @@ |
38 | 38 | ) |
39 | 39 | ) |
40 | 40 | ); |
41 | | - SpecialPage :: SpecialPage( 'Search' ); |
| 41 | + parent::__construct( 'Search' ); |
42 | 42 | } |
43 | 43 | } |
44 | 44 | } |