Index: trunk/extensions/ConfirmAccount/SpecialConfirmAccount.php |
— | — | @@ -21,6 +21,8 @@ |
22 | 22 |
|
23 | 23 | # Set the person's bio as their userpage?
|
24 | 24 | $wgMakeUserPageFromBio = true;
|
| 25 | +$wgSaveRejectedAccountReqs = true;
|
| 26 | +$wgRejectedAccountMaxAge = 7 * 24 * 3600; // One week
|
25 | 27 |
|
26 | 28 | $wgGroupPermissions['*']['createaccount'] = false;
|
27 | 29 | $wgGroupPermissions['sysop']['createaccount'] = false;
|
Index: trunk/extensions/ConfirmAccount/ConfirmAccount.sql |
— | — | @@ -27,9 +27,6 @@ |
28 | 28 | acr_email_token binary(32),
|
29 | 29 | -- Expiration date for the user_email_token
|
30 | 30 | acr_email_token_expires binary(14),
|
31 | | - -- Timestamp of account registration.
|
32 | | - -- Accounts predating this schema addition may contain NULL.
|
33 | | - acr_registration char(14) NOT NULL,
|
34 | 31 | -- A little about this user
|
35 | 32 | acr_bio mediumblob default '',
|
36 | 33 | -- Private info for reviewers to look at when considering request
|
— | — | @@ -39,8 +36,13 @@ |
40 | 37 | -- IP address
|
41 | 38 | acr_ip VARCHAR(255) NULL default '',
|
42 | 39 |
|
| 40 | + -- Timestamp of account registration.
|
| 41 | + acr_registration char(14) NOT NULL,
|
| 42 | + -- Flag for rejected requests
|
| 43 | + acr_rejected bool NOT NULL,
|
| 44 | +
|
43 | 45 | PRIMARY KEY (acr_id),
|
44 | 46 | UNIQUE KEY (acr_name),
|
45 | | - INDEX (acr_registration),
|
46 | | - INDEX (acr_email_token)
|
| 47 | + INDEX (acr_email_token),
|
| 48 | + INDEX acr_rejected_reg (acr_rejected,acr_registration)
|
47 | 49 | ) TYPE=InnoDB; |
\ No newline at end of file |
Index: trunk/extensions/ConfirmAccount/ConfirmAccount.pg.sql |
— | — | @@ -18,10 +18,11 @@ |
19 | 19 | acr_bio TEXT,
|
20 | 20 | acr_notes TEXT,
|
21 | 21 | acr_url TEXT,
|
22 | | - acr_ip CIDR
|
| 22 | + acr_ip CIDR,
|
| 23 | + acr_rejected BOOL NOT NULL,
|
23 | 24 | );
|
24 | 25 |
|
25 | | -CREATE INDEX acr_registration ON account_requests (acr_registration),
|
| 26 | +CREATE INDEX acr_rejected_reg ON account_requests (acr_rejected,acr_registration),
|
26 | 27 | CREATE INDEX acr_email_token ON account_requests (acr_email_token);
|
27 | 28 |
|
28 | 29 | COMMIT;
|
Index: trunk/extensions/ConfirmAccount/ConfirmAccount_body.php |
— | — | @@ -360,6 +360,8 @@ |
361 | 361 | # For renaming to alot for collisions with other local requests
|
362 | 362 | # that were added to some global $wgAuth system first.
|
363 | 363 | $this->mUsername = $wgRequest->getText( 'wpNewName' );
|
| 364 | + # For viewing rejects
|
| 365 | + $this->showRejects = $wgRequest->getBool( 'wpShowRejects' );
|
364 | 366 |
|
365 | 367 | $this->skin = $wgUser->getSkin();
|
366 | 368 |
|
— | — | @@ -395,7 +397,16 @@ |
396 | 398 | }
|
397 | 399 |
|
398 | 400 | $dbw = wfGetDB( DB_MASTER );
|
399 | | - $dbw->delete( 'account_requests', array('acr_id' => $this->acrID), __METHOD__ );
|
| 401 | + # Either mark off the row as deleted or wipe it completely
|
| 402 | + global $wgSaveRejectedAccountReqs;
|
| 403 | + if( $wgSaveRejectedAccountReqs ) {
|
| 404 | + # Request can later be recovered
|
| 405 | + $dbw->update( 'account_requests', array('acr_rejected' => 1),
|
| 406 | + array('acr_id' => $this->acrID),
|
| 407 | + __METHOD__ );
|
| 408 | + } else {
|
| 409 | + $dbw->delete( 'account_requests', array('acr_id' => $this->acrID), __METHOD__ );
|
| 410 | + }
|
400 | 411 |
|
401 | 412 | $this->showSuccess( $action );
|
402 | 413 | } else if( $action == 'accept' ) {
|
— | — | @@ -466,16 +477,20 @@ |
467 | 478 | $wgOut->addHTML( '<div class="errorbox">' . $msg . '</div><div class="visualClear"></div>' );
|
468 | 479 | }
|
469 | 480 |
|
470 | | - $listLink = $this->skin->makeKnownLinkObj( $wgTitle, wfMsgHtml( 'confirmaccount-back' ) );
|
471 | | - $wgOut->setSubtitle( '<p>'.$listLink.'</p>' );
|
472 | | -
|
473 | 481 | $row = $this->getRequest();
|
474 | | - if( !$row ) {
|
| 482 | + if( !$row || $row->acr_rejected && !$this->showRejects ) {
|
475 | 483 | $wgOut->addHTML( wfMsg('confirmaccount-badid') );
|
476 | 484 | $wgOut->returnToMain( true, $wgTitle );
|
477 | 485 | return;
|
478 | 486 | }
|
479 | 487 |
|
| 488 | + $listLink = $this->skin->makeKnownLinkObj( $wgTitle, wfMsgHtml( 'confirmaccount-back' ) );
|
| 489 | + if( $this->showRejects ) {
|
| 490 | + $listLink .= ' / '.$this->skin->makeKnownLinkObj( $wgTitle, wfMsgHtml( 'confirmaccount-back2' ),
|
| 491 | + wfArrayToCGI( array('wpShowRejects' => 1 ) ) );
|
| 492 | + }
|
| 493 | + $wgOut->setSubtitle( '<p>'.$listLink.'</p>' );
|
| 494 | +
|
480 | 495 | $wgOut->addWikiText( wfMsg( "confirmacount-text" ) );
|
481 | 496 |
|
482 | 497 | $action = $wgTitle->escapeLocalUrl( 'action=submit' );
|
— | — | @@ -557,16 +572,42 @@ |
558 | 573 | }
|
559 | 574 |
|
560 | 575 | function showList() {
|
561 | | - global $wgOut, $wgUser, $wgLang;
|
| 576 | + global $wgOut, $wgUser, $wgTitle, $wgLang;
|
| 577 | +
|
| 578 | + if( $this->showRejects ) {
|
| 579 | + $listLink = $this->skin->makeKnownLinkObj( $wgTitle, wfMsgHtml( 'confirmaccount-back' ) );
|
| 580 | + } else {
|
| 581 | + $listLink = $this->skin->makeKnownLinkObj( $wgTitle, wfMsgHtml( 'confirmaccount-back2' ),
|
| 582 | + wfArrayToCGI( array('wpShowRejects' => 1 ) ) );
|
| 583 | + }
|
| 584 | + $wgOut->setSubtitle( '<p>'.$listLink.'</p>' );
|
| 585 | +
|
| 586 | + global $wgSaveRejectedAccountReqs;
|
| 587 | + if( $wgSaveRejectedAccountReqs ) {
|
| 588 | + # Every 100th view, prune old deleted items
|
| 589 | + wfSeedRandom();
|
| 590 | + if( 0 == mt_rand( 0, 99 ) ) {
|
| 591 | + global $wgRejectedAccountMaxAge;
|
562 | 592 |
|
563 | | - $pager = new ConfirmAccountsPager( $this, array() );
|
| 593 | + $dbw = wfGetDB( DB_MASTER );
|
| 594 | + $cutoff = $dbw->timestamp( time() - $wgRejectedAccountMaxAge );
|
| 595 | + $accountrequests = $dbw->tableName( 'account_requests' );
|
| 596 | + $sql = "DELETE FROM $accountrequests WHERE acr_registration < '{$cutoff}'";
|
| 597 | + $dbw->query( $sql );
|
| 598 | + }
|
| 599 | + }
|
| 600 | +
|
| 601 | + $pager = new ConfirmAccountsPager( $this, array(), $this->showRejects );
|
564 | 602 | if ( $pager->getNumRows() ) {
|
565 | 603 | $wgOut->addHTML( wfMsgExt('confirmacount-list', array('parse') ) );
|
566 | 604 | $wgOut->addHTML( $pager->getNavigationBar() );
|
567 | 605 | $wgOut->addHTML( "<ul>" . $pager->getBody() . "</ul>" );
|
568 | 606 | $wgOut->addHTML( $pager->getNavigationBar() );
|
569 | 607 | } else {
|
570 | | - $wgOut->addHTML( wfMsgExt('confirmacount-none', array('parse')) );
|
| 608 | + if( $this->showRejects )
|
| 609 | + $wgOut->addHTML( wfMsgExt('confirmacount-none2', array('parse')) );
|
| 610 | + else
|
| 611 | + $wgOut->addHTML( wfMsgExt('confirmacount-none', array('parse')) );
|
571 | 612 | }
|
572 | 613 | }
|
573 | 614 |
|
— | — | @@ -574,7 +615,12 @@ |
575 | 616 | global $wgLang, $wgUser;
|
576 | 617 |
|
577 | 618 | $title = SpecialPage::getTitleFor( 'ConfirmAccounts' );
|
578 | | - $link = $this->skin->makeKnownLinkObj( $title, wfMsg('confirmaccount-review'), 'acrid='.$row->acr_id );
|
| 619 | + if( $this->showRejects ) {
|
| 620 | + $link = $this->skin->makeKnownLinkObj( $title, wfMsg('confirmaccount-review'),
|
| 621 | + 'acrid='.$row->acr_id.'&wpShowRejects=1' );
|
| 622 | + } else {
|
| 623 | + $link = $this->skin->makeKnownLinkObj( $title, wfMsg('confirmaccount-review'), 'acrid='.$row->acr_id );
|
| 624 | + }
|
579 | 625 | $time = $wgLang->timeanddate( wfTimestamp(TS_MW, $row->acr_registration), true );
|
580 | 626 |
|
581 | 627 | $r = '<li>';
|
— | — | @@ -607,9 +653,10 @@ |
608 | 654 | class ConfirmAccountsPager extends ReverseChronologicalPager {
|
609 | 655 | public $mForm, $mConds;
|
610 | 656 |
|
611 | | - function __construct( $form, $conds = array() ) {
|
| 657 | + function __construct( $form, $conds = array(), $rejects=0 ) {
|
612 | 658 | $this->mForm = $form;
|
613 | 659 | $this->mConds = $conds;
|
| 660 | + $this->mConds['acr_rejected'] = $rejects;
|
614 | 661 | parent::__construct();
|
615 | 662 | }
|
616 | 663 |
|
Index: trunk/extensions/ConfirmAccount/ConfirmAccount.i18n.php |
— | — | @@ -62,8 +62,10 @@ |
63 | 63 |
|
64 | 64 | If you simply leave this page without confirming or denying this request, it will remain pending.',
|
65 | 65 | 'confirmacount-none' => 'There are currently no pending account requests.',
|
| 66 | + 'confirmacount-none2' => 'There are currently no recently rejected account requests.',
|
66 | 67 | 'confirmaccount-badid' => 'There is no pending request corresponding to the given ID. It may have already been handled.',
|
67 | 68 | 'confirmaccount-back' => 'View pending account list',
|
| 69 | + 'confirmaccount-back2' => 'View recently rejected account list',
|
68 | 70 | 'confirmaccount-name' => 'Username',
|
69 | 71 | 'confirmaccount-real' => 'Name',
|
70 | 72 | 'confirmaccount-email' => 'Email',
|