r81587 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r81586‎ | r81587 | r81588 >
Date:04:52, 6 February 2011
Author:aaron
Status:ok
Tags:
Comment:
* Converted ConfirmAccount to use RL
* Avoid breaking filecache fallback if DB is down
* Fixed special page alias notice
Modified paths:
  • /trunk/extensions/ConfirmAccount/ConfirmAccount.php (modified) (history)
  • /trunk/extensions/ConfirmAccount/ConfirmAccount_body.php (modified) (history)
  • /trunk/extensions/ConfirmAccount/RequestAccount_body.php (modified) (history)
  • /trunk/extensions/ConfirmAccount/UserCredentials_body.php (modified) (history)

Diff [purge]

Index: trunk/extensions/ConfirmAccount/UserCredentials_body.php
@@ -31,6 +31,7 @@
3232 } else {
3333 $this->showForm();
3434 }
 35+ $wgOut->addModules( 'ext.confirmAccount' ); // CSS
3536 }
3637
3738 function showForm() {
Index: trunk/extensions/ConfirmAccount/ConfirmAccount.php
@@ -143,19 +143,18 @@
144144 $wgExtensionMessagesFiles['ConfirmAccount'] = $dir . 'ConfirmAccount.i18n.php';
145145 $wgExtensionAliasesFiles['ConfirmAccount'] = $dir . 'ConfirmAccount.alias.php';
146146
147 -function efLoadConfirmAccount() {
148 - global $wgUser;
149 - # Don't load unless needed
150 - if ( $wgUser->getId() && $wgUser->isAllowed( 'confirmaccount' ) ) {
151 - efConfirmAccountInjectStyle();
152 - }
153 -}
 147+$wgResourceModules['ext.confirmAccount'] = array(
 148+ 'styles' => 'confirmaccount.css',
 149+ 'localBasePath' => dirname( __FILE__ ),
 150+ 'remoteExtPath' => 'ConfirmAccount',
 151+);
154152
155153 function efAddRequestLoginText( &$template ) {
156 - global $wgUser;
 154+ global $wgUser, $wgOut;
157155 # Add a link to RequestAccount from UserLogin
158156 if ( !$wgUser->isAllowed( 'createaccount' ) ) {
159 - $template->set( 'header', wfMsgExt( 'requestaccount-loginnotice', array( 'parse' ) ) );
 157+ $template->set( 'header', wfMsgExt( 'requestaccount-loginnotice', 'parse' ) );
 158+ $wgOut->addModules( 'ext.confirmAccount' ); // CSS
160159 }
161160 return true;
162161 }
@@ -183,19 +182,7 @@
184183 return true;
185184 }
186185
187 -function efConfirmAccountInjectStyle() {
188 - global $wgOut, $wgUser, $wgScriptPath;
189 - # FIXME: find better load place
190 - # UI CSS
191 - $wgOut->addLink( array(
192 - 'rel' => 'stylesheet',
193 - 'type' => 'text/css',
194 - 'media' => 'screen',
195 - 'href' => $wgScriptPath . '/extensions/ConfirmAccount/confirmaccount.css',
196 - ) );
197 - return true;
198 -}
199 -
 186+// FIXME: don't just take on to general site notice
200187 function efConfirmAccountsNotice( $notice ) {
201188 global $wgConfirmAccountNotice, $wgUser;
202189 if ( !$wgConfirmAccountNotice || !$wgUser->isAllowed( 'confirmaccount' ) ) {
@@ -209,7 +196,9 @@
210197 if ( !$count ) {
211198 $dbw = wfGetDB( DB_MASTER );
212199 $count = $dbw->selectField( 'account_requests', 'COUNT(*)',
213 - array( 'acr_deleted' => 0, 'acr_held IS NULL', 'acr_email_authenticated IS NOT NULL' ),
 200+ array( 'acr_deleted' => 0,
 201+ 'acr_held IS NULL',
 202+ 'acr_email_authenticated IS NOT NULL' ),
214203 __METHOD__ );
215204 # Use '-' for zero, to avoid any confusion over key existence
216205 if ( !$count ) {
@@ -220,8 +209,9 @@
221210 }
222211 if ( $count !== '-' ) {
223212 $message = wfMsgExt( 'confirmaccount-newrequests', array( 'parsemag' ), $count );
224 -
225 - $notice .= '<div id="mw-confirmaccount-msg" class="mw-confirmaccount-bar">' . $wgOut->parse( $message ) . '</div>';
 213+ $notice .= '<div id="mw-confirmaccount-msg" class="mw-confirmaccount-bar">' .
 214+ $wgOut->parse( $message ) . '</div>';
 215+ $wgOut->addModules( 'ext.confirmAccount' ); // CSS
226216 }
227217 return true;
228218 }
@@ -240,7 +230,6 @@
241231 $wgAutoloadClasses['UserCredentialsPage'] = $dir . 'UserCredentials_body.php';
242232 $wgSpecialPageGroups['UserCredentials'] = 'users';
243233
244 -$wgExtensionFunctions[] = 'efLoadConfirmAccount';
245234 # Make sure "login / create account" notice still as "create account"
246235 $wgHooks['PersonalUrls'][] = 'efSetRequestLoginLinks';
247236 # Add notice of where to request an account at UserLogin
Index: trunk/extensions/ConfirmAccount/RequestAccount_body.php
@@ -74,6 +74,7 @@
7575 } else {
7676 $this->showForm();
7777 }
 78+ $wgOut->addModules( 'ext.confirmAccount' ); // CSS
7879 }
7980
8081 protected function showForm( $msg = '', $forgotFile = 0 ) {
Index: trunk/extensions/ConfirmAccount/ConfirmAccount_body.php
@@ -12,6 +12,7 @@
1313 parent::__construct('ConfirmAccounts','confirmaccount');
1414 }
1515
 16+ // @TODO: split out listlink mess
1617 function execute( $par ) {
1718 global $wgRequest, $wgOut, $wgUser, $wgAccountRequestTypes, $wgLang;
1819
@@ -145,6 +146,7 @@
146147 } else {
147148 $this->showQueues();
148149 }
 150+ $wgOut->addModules( 'ext.confirmAccount' ); // CSS
149151 }
150152
151153 protected function showQueues() {
@@ -323,7 +325,7 @@
324326 $form .= self::parseLinks($row->acr_urls);
325327 }
326328 if( $wgUser->isAllowed( 'requestips' ) ) {
327 - $blokip = SpecialPage::getTitleFor( 'blockip' );
 329+ $blokip = SpecialPage::getTitleFor( 'Blockip' );
328330 $form .= "<p>".wfMsgHtml('confirmaccount-ip')." ".htmlspecialchars($row->acr_ip).
329331 " (" . $this->skin->makeKnownLinkObj( $blokip, wfMsgHtml('blockip'),
330332 'ip=' . $row->acr_ip . '&wpCreateAccount=1' ).")</p>\n";

Status & tagging log