A partial archive of https://discourse-mediawiki.wmflabs.org as of Saturday May 21, 2022.

ConfirmAccount: Failed Bug-Fix

johnyradio

I attempted a fix on an extension, but my fix did not seem to work. Any suggestions?

Details:

https://phabricator.wikimedia.org/T190343

Tgr

It’s probably easier to get feedback if you upload your attempted fix as a gerrit patch.

johnyradio

thx.

Attempting to register on gerrit, i’m getting

verify from a labs instance whether the shell username is taken, by issuing the command groups $username on a shell.

What’s a labs instance?

Tgr

Ugh, that instruction is terrible. Just ignore it, if the shell name is reserved, you get an error about that anyway.

johnyradio

heh, i figured as much. so i have to install gerrit server on my local Windows computer, install the test code, then run shell commands to upload the code, etc etc. Hoping to solve the issue without all that time/effort/complexity. Hoping to solve this just by examining the code.

Now making progress with someone over on #wikimedia-tech IRC.

Issue seems related to $wgRejectedAccountMaxAge flag. Not mentioned in the extension page, but various switches (including that one) are listed in /extensions/ConfirmAccount/ConfirmAccount.config.php

It says:

######## Configuration variables

IMPORTANT: DO NOT EDIT THIS FILE

When configuring globals, set them at LocalSettings.php instead

When i set wgRejectedAccountMaxAge = 0 (in LocalSettings.php), and then do a request, then remnant rejects go away except the current one. Now working on exactly where the prune should happen-- after the reject action, or before the request action

johnyradio

looks like i solved it. There are 2 steps:

  • Set rejected items to expire immediately (LocalSettings.php)
  • Prune rejected items at beginning of Request action (RequestAccount_body.php)

Details:

in LocalSettings.php, after required declaration, set Rejected-Age to 0. That ensures rejected requests will be removed on prune-action:

require_once "$IP/extensions/ConfirmAccount/ConfirmAccount.php";
$wgRejectedAccountMaxAge = 0;

Add Prune code to the function that shows the Request form:

in /ConfirmAccount/frontend/specialpages/actions/RequestAccount_body.php
function showForm. Add very last command in the function:

old code:

$out->addWikiMsg( 'requestaccount-footer' );
}

new code:

$out->addWikiMsg( 'requestaccount-footer' );		
# PRUNE
ConfirmAccount::runAutoMaintenance();
}