r64418 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r64417‎ | r64418 | r64419 >
Date:02:45, 31 March 2010
Author:aaron
Status:ok
Tags:
Comment:
Cleaned up confirmEmailToken() email handling a bit
Modified paths:
  • /trunk/extensions/ConfirmAccount/RequestAccount_body.php (modified) (history)

Diff [purge]

Index: trunk/extensions/ConfirmAccount/RequestAccount_body.php
@@ -504,13 +504,18 @@
505505 # Send confirmation email to prospective user
506506 $this->confirmEmail( $name );
507507 # Send mail to admin after e-mail has been confirmed
508 - if ( $wgConfirmAccountContact ) {
509 - $u = User::newFromName( $name, 'creatable' );
510 - $u->setEmail( $wgConfirmAccountContact );
511 - $title = Title::makeTitle( NS_SPECIAL, 'ConfirmAccounts' );
512 - $url = $title->getFullUrl();
513 - $u->sendMail( wfMsg( 'requestaccount-email-subj-admin' ),
514 - wfMsg( 'requestaccount-email-body-admin', $name, $url ) );
 508+ global $wgConfirmAccountContact, $wgPasswordSender;
 509+ if ( $wgConfirmAccountContact != '' ) {
 510+ $target = new MailAddress( $wgConfirmAccountContact );
 511+ $source = new MailAddress( $wgPasswordSender );
 512+ $title = SpecialPage::getTitleFor( 'ConfirmAccounts' );
 513+ $subject = wfMsg( 'requestaccount-email-subj-admin' );
 514+ $body = wfMsg( 'requestaccount-email-body-admin', $name, $title->getFullUrl() );
 515+ # Actually send the email...
 516+ $result = UserMailer::send( $target, $source, $subject, $body );
 517+ if ( WikiError::isError( $result ) ) {
 518+ wfDebug( "Could not sent email to admin at $target\n" );
 519+ }
515520 }
516521 $wgOut->addWikiText( wfMsgHtml( 'request-account-econf' ) );
517522 $wgOut->returnToMain();

Status & tagging log