r98637 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r98636‎ | r98637 | r98638 >
Date:22:43, 1 October 2011
Author:reedy
Status:ok
Tags:
Comment:
Update some deprecated stuff

Fixed missing $dbr
Modified paths:
  • /trunk/extensions/ConfirmAccount/business/AccountRequestSubmission.php (modified) (history)
  • /trunk/extensions/ConfirmAccount/dataclasses/ConfirmAccount.class.php (modified) (history)

Diff [purge]

Index: trunk/extensions/ConfirmAccount/dataclasses/ConfirmAccount.class.php
@@ -128,7 +128,8 @@
129129 * @return string|false
130130 */
131131 public function requestNameFromEmailToken( $code ) {
132 - return wfGetDB( DB_SLAVE )->selectField( 'account_requests',
 132+ $dbr = wfGetDB( DB_SLAVE );
 133+ return $dbr->selectField( 'account_requests',
133134 'acr_name',
134135 array(
135136 'acr_email_token' => md5( $code ),
Index: trunk/extensions/ConfirmAccount/business/AccountRequestSubmission.php
@@ -93,7 +93,7 @@
9494 return array( 'acct_request_skipped_tos', wfMsgHtml( 'requestaccount-agree' ) );
9595 }
9696 # Validate email address
97 - if ( !$u->isValidEmailAddr( $this->email ) ) {
 97+ if ( !Sanitizer::validateEmail( $this->email ) ) {
9898 return array( 'acct_request_invalid_email', wfMsgHtml( 'invalidemailaddress' ) );
9999 }
100100 # Check if biography is long enough
@@ -161,6 +161,9 @@
162162 }
163163 $expires = null; // passed by reference
164164 $token = ConfirmAccount::getConfirmationToken( $u, $expires );
 165+
 166+ global $wgRequest;
 167+ $ip = $wgRequest->getIP();
165168 # Insert into pending requests...
166169 $req = UserAccountRequest::newFromArray( array(
167170 'name' => $u->getName(),
@@ -179,12 +182,12 @@
180183 'comment' => '',
181184 'email_token' => md5( $token ),
182185 'email_token_expires' => $expires,
183 - 'ip' => wfGetIP(),
 186+ 'ip' => $ip,
184187 ) );
185188 $dbw->begin();
186189 $req->insertOn();
187190 # Send confirmation, required!
188 - $result = ConfirmAccount::sendConfirmationMail( $u, wfGetIP(), $token, $expires );
 191+ $result = ConfirmAccount::sendConfirmationMail( $u, $ip, $token, $expires );
189192 if ( !$result->isOK() ) {
190193 $dbw->rollback(); // Nevermind
191194 return array( 'acct_request_mail_failed',
@@ -197,7 +200,7 @@
198201 # No request spamming...
199202 # BC: check if isPingLimitable() exists
200203 if ( $wgAccountRequestThrottle && $reqUser->isPingLimitable() ) {
201 - $key = wfMemcKey( 'acctrequest', 'ip', wfGetIP() );
 204+ $key = wfMemcKey( 'acctrequest', 'ip', $ip );
202205 $value = $wgMemc->incr( $key );
203206 if ( !$value ) {
204207 $wgMemc->set( $key, 1, 86400 );

Status & tagging log