Page MenuHomePhabricator

Create a shell script to reset many email addresses at once
Closed, ResolvedPublicFeature

Description

With the onset of MW-on-K8s, running a user script takes much longer. This isn't a huge problem since you can run these scripts sequentially, but with the EmailAuth reset flow that T&S runs, it means a new job is created for every reset, which can be quite a lot of resets at one time.

Example logs to show the issue (the scripts we run look like: mwscript-k8s -f -- resetUserEmail.php --wiki enwiki 'Foobar' example@example.com --email-password)

⏳ Starting resetUserEmail.php on Kubernetes as job mw-script.codfw.f00b4r ...
👋 Refreshing the local Helm cache...
🚀 Job is running.
📜 Streaming logs:
Done!
⏳ Starting resetUserEmail.php on Kubernetes as job mw-script.codfw.f00b4z ...
👋 Refreshing the local Helm cache...
🚀 Job is running.
📜 Streaming logs:
Done!

[and repeat 50+ times]

Moving to a script that allows multiple resets should allow for fewer k8s jobs to be created (and thus less noise in the logs) as well as saving some time for support staff working on these resets.

Event Timeline

Hi! I prepared a patch for this. It adds a --file option to resetUserEmail.php that reads username/email pairs from a text file and processes them all in one go. Existing single-user usage stays the same. If the approach looks fine I can submit it.

Change #1276507 had a related patch set uploaded (by HakanIST; author: HakanIST):

[mediawiki/core@master] resetUserEmail: Add batch processing support via --file option

https://gerrit.wikimedia.org/r/1276507

Patch submitted: https://gerrit.wikimedia.org/r/c/mediawiki/core/+/1276507

Usage:

resetUserEmail.php --file /path/to/resets.tsv --email-password

File format is tab-separated (TSV) to support usernames with spaces:

Username With Spaces	new@example.com
#12345	another@example.com
# comment lines are skipped

Also modernized the script to use UserFactory (replaces deprecated User::newFromName/newFromId).

Change #1276507 merged by jenkins-bot:

[mediawiki/core@master] resetUserEmail: Add batch processing support via --file option

https://gerrit.wikimedia.org/r/1276507