r24136 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r24135‎ | r24136 | r24137 >
Date:23:11, 15 July 2007
Author:aaron
Status:old
Tags:
Comment:
*Record name of the user that rejects a request
Modified paths:
  • /trunk/extensions/ConfirmAccount/ConfirmAccount.i18n.php (modified) (history)
  • /trunk/extensions/ConfirmAccount/ConfirmAccount.pg.sql (modified) (history)
  • /trunk/extensions/ConfirmAccount/ConfirmAccount.sql (modified) (history)
  • /trunk/extensions/ConfirmAccount/ConfirmAccount_body.php (modified) (history)
  • /trunk/extensions/ConfirmAccount/SpecialConfirmAccount.php (modified) (history)

Diff [purge]

Index: trunk/extensions/ConfirmAccount/SpecialConfirmAccount.php
@@ -23,13 +23,13 @@
2424 $wgMakeUserPageFromBio = true;
2525 $wgSaveRejectedAccountReqs = true;
2626 $wgRejectedAccountMaxAge = 7 * 24 * 3600; // One week
 27+# How many requests can an IP make at once?
 28+$wgAccountRequestThrottle = 1;
2729
2830 $wgGroupPermissions['*']['createaccount'] = false;
2931 $wgGroupPermissions['sysop']['createaccount'] = false;
3032 $wgGroupPermissions['bureaucrat']['confirmaccount'] = true;
3133
32 -$wgAccountRequestThrottle = 1;
33 -
3434 # Internationalisation
3535 require_once( 'ConfirmAccount.i18n.php' );
3636
@@ -57,7 +57,7 @@
5858 $dup = $dbw->selectField( 'account_requests', '1',
5959 array( 'acr_name' => $user->getName() ),
6060 __METHOD__ );
61 -
 61+
6262 if ( $dup ) {
6363 $abortError = wfMsgHtml('requestaccount-inuse');
6464 }
Index: trunk/extensions/ConfirmAccount/ConfirmAccount.sql
@@ -40,6 +40,8 @@
4141 acr_registration char(14) NOT NULL,
4242 -- Flag for rejected requests
4343 acr_rejected bool NOT NULL,
 44+ -- The user who rejected it
 45+ acr_user int unsigned NOT NULL default 0,
4446
4547 PRIMARY KEY (acr_id),
4648 UNIQUE KEY (acr_name),
Index: trunk/extensions/ConfirmAccount/ConfirmAccount.pg.sql
@@ -8,7 +8,7 @@
99 CREATE SEQUENCE account_requests_acr_id_seq;
1010 CREATE TABLE account_requests (
1111 acr_id INTEGER NOT NULL DEFAULT nextval('account_requests_acr_id_seq'),
12 - acr_name TEXT NOT NULL UNIQUE,
 12+ acr_name TEXT NOT NULL UNIQUE,
1313 acr_real_name TEXT,
1414 acr_email TEXT,
1515 acr_email_token CHAR(32),
@@ -20,6 +20,7 @@
2121 acr_url TEXT,
2222 acr_ip CIDR,
2323 acr_rejected BOOL NOT NULL,
 24+ acr_user INTEGER REFERENCES mwuser(user_id) ON DELETE SET NULL,
2425 );
2526
2627 CREATE INDEX acr_rejected_reg ON account_requests (acr_rejected,acr_registration),
Index: trunk/extensions/ConfirmAccount/ConfirmAccount_body.php
@@ -385,24 +385,28 @@
386386 }
387387
388388 if( $action == 'reject' ) {
 389+ global $wgSaveRejectedAccountReqs;
389390 # Make proxy user to email a rejection message :(
390391 $u = User::newFromName( $row->acr_name, 'creatable' );
391392 $u->setEmail( $row->acr_email );
392 - $result = $u->sendMail( wfMsg( 'confirmaccount-email-subj' ),
393 - wfMsg( 'confirmaccount-email-body2', $u->getName() ) );
394 - if( WikiError::isError( $result ) ) {
395 - $error = wfMsg( 'mailerror', htmlspecialchars( $result->getMessage() ) );
396 - $this->showForm( $error );
397 - return false;
 393+ # Do not send multiple times
 394+ if( !$row->acr_rejected ) {
 395+ $result = $u->sendMail( wfMsg( 'confirmaccount-email-subj' ),
 396+ wfMsg( 'confirmaccount-email-body2', $u->getName() ) );
 397+ if( WikiError::isError( $result ) ) {
 398+ $error = wfMsg( 'mailerror', htmlspecialchars( $result->getMessage() ) );
 399+ $this->showForm( $error );
 400+ return false;
 401+ }
398402 }
399 -
400403 $dbw = wfGetDB( DB_MASTER );
401404 # Either mark off the row as deleted or wipe it completely
402 - global $wgSaveRejectedAccountReqs;
403405 if( $wgSaveRejectedAccountReqs ) {
 406+ global $wgUser;
404407 # Request can later be recovered
405 - $dbw->update( 'account_requests', array('acr_rejected' => 1),
406 - array('acr_id' => $this->acrID),
 408+ $dbw->update( 'account_requests',
 409+ array( 'acr_rejected' => 1, 'acr_user' => $wgUser->getID() ),
 410+ array( 'acr_id' => $this->acrID ),
407411 __METHOD__ );
408412 } else {
409413 $dbw->delete( 'account_requests', array('acr_id' => $this->acrID), __METHOD__ );
@@ -566,7 +570,7 @@
567571 if( $action == 'accept' )
568572 $wgOut->addWikiText( wfMsg( "confirmaccount-acc", $name ) );
569573 else
570 - $wgOut->addWikiText( wfMsg( "confirmaccount-del" ) );
 574+ $wgOut->addWikiText( wfMsg( "confirmaccount-rej" ) );
571575
572576 $wgOut->returnToMain( true, $wgTitle );
573577 }
@@ -624,8 +628,10 @@
625629 $time = $wgLang->timeanddate( wfTimestamp(TS_MW, $row->acr_registration), true );
626630
627631 $r = '<li>';
628 - $r .= $time." ($link)".'<br/>';
629 - $r .= '<table cellspacing=\'1\' cellpadding=\'3\' border=\'1\' width=\'100%\'>';
 632+ $r .= $time." ($link)";
 633+ if( $this->showRejects )
 634+ $r .= ' <strong>'.wfMsgExt( 'confirmaccount-reject', array('parseinline'), $row->user_name ).'</strong>';
 635+ $r .= '<br/><table cellspacing=\'1\' cellpadding=\'3\' border=\'1\' width=\'100%\'>';
630636 $r .= '<tr><td><strong>'.wfMsg('confirmaccount-name').'</strong></td><td width=\'100%\'>' .
631637 htmlspecialchars($row->acr_name) . '</td></tr>';
632638 $r .= '<tr><td><strong>'.wfMsg('confirmaccount-real').'</strong></td><td width=\'100%\'>' .
@@ -667,10 +673,12 @@
668674
669675 function getQueryInfo() {
670676 $conds = $this->mConds;
 677+ $conds[] = 'acr_user = user_id';
 678+
671679 return array(
672 - 'tables' => array('account_requests'),
 680+ 'tables' => array('account_requests','user'),
673681 'fields' => 'acr_id,acr_name,acr_real_name,acr_registration,acr_email,acr_email_authenticated,
674 - acr_bio,acr_notes,acr_urls',
 682+ acr_bio,acr_notes,acr_urls,acr_user,user_name',
675683 'conds' => $conds
676684 );
677685 }
Index: trunk/extensions/ConfirmAccount/ConfirmAccount.i18n.php
@@ -73,10 +73,11 @@
7474 'confirmaccount-review' => 'Approve/Reject',
7575 'confirmacount-confirm' => 'Use the buttons below to irreversibly confirm this request and create the account or deny it.',
7676 'confirmaccount-econf' => '(confirmed)',
 77+ 'confirmaccount-reject' => '(rejected by [[User:$1|$1]])',
7778 'confirmacount-create' => 'Confirm (create account)',
7879 'confirmacount-deny' => 'Reject',
7980 'confirmaccount-acc' => 'Account request confirmed successfully; created new user account [[User:$1]].',
80 - 'confirmaccount-del' => 'Account request rejected and successfully deleted.',
 81+ 'confirmaccount-rej' => 'Account request rejected successfully.',
8182 'confirmaccount-summary' => 'Creating user page with biography of new user.',
8283 'confirmaccount-email-subj' => '{{SITENAME}} account request',
8384 'confirmaccount-email-body' => 'Your request for an account has been approved on {{SITENAME}}.

Status & tagging log