r98105 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r98104‎ | r98105 | r98106 >
Date:02:22, 26 September 2011
Author:aaron
Status:deferred
Tags:
Comment:
Moved sendConfirmationMail() to ConfirmAccount.class.php
Modified paths:
  • /trunk/extensions/ConfirmAccount/dataclasses/ConfirmAccount.class.php (modified) (history)
  • /trunk/extensions/ConfirmAccount/presentation/specialpages/actions/RequestAccount_body.php (modified) (history)

Diff [purge]

Index: trunk/extensions/ConfirmAccount/dataclasses/ConfirmAccount.class.php
@@ -92,6 +92,33 @@
9393 }
9494
9595 /**
 96+ * Generate a new e-mail confirmation token and send a confirmation
 97+ * mail to the user's given address.
 98+ *
 99+ * @param User $user
 100+ * @param string $ip User IP address
 101+ * @param string $token
 102+ * @param string $expiration
 103+ * @return mixed True on success, a Status object on failure.
 104+ */
 105+ public static function sendConfirmationMail( User $user, $ip, $token, $expiration ) {
 106+ global $wgContLang;
 107+ $url = self::confirmationTokenUrl( $token );
 108+ $lang = $user->getOption( 'language' );
 109+ return $user->sendMail(
 110+ wfMessage( 'requestaccount-email-subj' )->inLanguage( $lang )->text(),
 111+ wfMessage( 'requestaccount-email-body',
 112+ $ip,
 113+ $user->getName(),
 114+ $url,
 115+ $wgContLang->timeanddate( $expiration, false ) ,
 116+ $wgContLang->date( $expiration, false ) ,
 117+ $wgContLang->time( $expiration, false )
 118+ )->inLanguage( $lang )->text()
 119+ );
 120+ }
 121+
 122+ /**
96123 * Verifies that it's ok to include the uploaded file
97124 *
98125 * @param string $tmpfile the full path of the temporary file to verify
Index: trunk/extensions/ConfirmAccount/presentation/specialpages/actions/RequestAccount_body.php
@@ -372,7 +372,7 @@
373373 $dbw->begin();
374374 $req->insertOn();
375375 # Send confirmation, required!
376 - $result = $this->sendConfirmationMail( $u, $token, $expires );
 376+ $result = ConfirmAccount::sendConfirmationMail( $u, wfGetIP(), $token, $expires );
377377 if ( !$result->isOK() ) {
378378 $dbw->rollback(); // Nevermind
379379 $error = wfMsg( 'mailerror', $wgOut->parse( $result->getWikiText() ) );
@@ -485,26 +485,4 @@
486486 );
487487 return $reqID;
488488 }
489 -
490 - /**
491 - * Generate a new e-mail confirmation token and send a confirmation
492 - * mail to the user's given address.
493 - *
494 - * @param User $user
495 - * @param string $token
496 - * @param string $expiration
497 - * @return mixed True on success, a Status object on failure.
498 - */
499 - protected function sendConfirmationMail( $user, $token, $expiration ) {
500 - global $wgContLang;
501 - $url = ConfirmAccount::confirmationTokenUrl( $token );
502 - return $user->sendMail( wfMsg( 'requestaccount-email-subj' ),
503 - wfMsg( 'requestaccount-email-body',
504 - wfGetIP(),
505 - $user->getName(),
506 - $url,
507 - $wgContLang->timeanddate( $expiration, false ) ,
508 - $wgContLang->date( $expiration, false ) ,
509 - $wgContLang->time( $expiration, false ) ) );
510 - }
511489 }

Status & tagging log