r98276 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r98275‎ | r98276 | r98277 >
Date:22:29, 27 September 2011
Author:aaron
Status:deferred
Tags:
Comment:
Refactored special page definitions and don't create UserCredentials is we don't store that data
Modified paths:
  • /trunk/extensions/ConfirmAccount/ConfirmAccount.php (modified) (history)
  • /trunk/extensions/ConfirmAccount/presentation/ConfirmAccountUI.hooks.php (modified) (history)

Diff [purge]

Index: trunk/extensions/ConfirmAccount/ConfirmAccount.php
@@ -154,18 +154,12 @@
155155 $wgAutoloadClasses['ConfirmAccountUIHooks'] = "$dir/ConfirmAccountUI.hooks.php";
156156
157157 $dir = dirname( __FILE__ ) . '/presentation/specialpages';
158 -# Request an account
159 -$wgSpecialPages['RequestAccount'] = 'RequestAccountPage';
 158+# UI to request an account
160159 $wgAutoloadClasses['RequestAccountPage'] = "$dir/actions/RequestAccount_body.php";
161 -$wgSpecialPageGroups['RequestAccount'] = 'login';
162 -# Confirm accounts
163 -$wgSpecialPages['ConfirmAccounts'] = 'ConfirmAccountsPage';
 160+# UI to confirm accounts
164161 $wgAutoloadClasses['ConfirmAccountsPage'] = "$dir/actions/ConfirmAccount_body.php";
165 -$wgSpecialPageGroups['ConfirmAccounts'] = 'users';
166 -# Account credentials
167 -$wgSpecialPages['UserCredentials'] = 'UserCredentialsPage';
 162+# UI to see account credentials
168163 $wgAutoloadClasses['UserCredentialsPage'] = "$dir/actions/UserCredentials_body.php";
169 -$wgSpecialPageGroups['UserCredentials'] = 'users';
170164
171165 $dir = dirname( __FILE__ ) . '/dataclasses';
172166 # Utility functions
@@ -190,4 +184,7 @@
191185 # Register admin pages for AdminLinks extension.
192186 $wgHooks['AdminLinks'][] = 'ConfirmAccountUIHooks::confirmAccountAdminLinks';
193187
 188+# Actually register some special pages
 189+$wgHooks['SpecialPage_initList'][] = 'ConfirmAccountUIHooks::defineSpecialPages';
 190+
194191 $wgHooks['LoadExtensionSchemaUpdates'][] = 'ConfirmAccountUpdaterHooks::addSchemaUpdates';
Index: trunk/extensions/ConfirmAccount/presentation/ConfirmAccountUI.hooks.php
@@ -3,6 +3,27 @@
44 * Class containing hooked functions for a ConfirmAccount environment
55 */
66 class ConfirmAccountUIHooks {
 7+ /*
 8+ * Register ConfirmAccount special pages as needed.
 9+ * Also sets $wgSpecialPages just to be consistent.
 10+ */
 11+ public static function defineSpecialPages( array &$list ) {
 12+ global $wgSpecialPages, $wgSpecialPageGroups, $wgConfirmAccountSaveInfo;
 13+
 14+ $list['RequestAccount'] = $wgSpecialPages['RequestAccount'] = 'RequestAccountPage';
 15+ $wgSpecialPageGroups['RequestAccount'] = 'login';
 16+
 17+ $list['ConfirmAccounts'] = $wgSpecialPages['ConfirmAccounts'] = 'ConfirmAccountsPage';
 18+ $wgSpecialPageGroups['ConfirmAccounts'] = 'users';
 19+
 20+ if ( $wgConfirmAccountSaveInfo ) {
 21+ $list['UserCredentials'] = $wgSpecialPages['UserCredentials'] = 'UserCredentialsPage';
 22+ $wgSpecialPageGroups['UserCredentials'] = 'users';
 23+ }
 24+
 25+ return true;
 26+ }
 27+
728 public static function addRequestLoginText( &$template ) {
829 global $wgUser, $wgOut;
930 # Add a link to RequestAccount from UserLogin

Status & tagging log