Auto Scheduled Tasks #23586
open
Pruning unconfirmed users
Added by Colin McDonald about 2 months ago.
Updated about 2 months ago.
Description
We talked in the call today about pruning (or perhaps just deleting, within a certain timeframe?) the ~50K unconfirmed users we realized in #23545 are being held after signing up for the Commons but not completing the process. It is probably a good idea security-wise, but perhaps it helps reduce our database load too.
- Related to Support #23545: over 50,000 unconfirmed users on my private site added
Do we want an automated tool to do this? I think we'd want something like:
1. Run on a schedule (how often? once monthly?)
2. Identify pending items of a certain age (how old? 1 month? 6 months?)
3. Delete them (what kind of logging do we need?)
If we want to do this in chunks, we could first build the tool that does 2 and 3, and run it manually at first. Then we can decide how and whether it's worth adding the automation (1).
WP-CLI does have a command to delete all signups with:
wp user signup delete --all
But we don't want to do that.
For age range, I'm thinking delete any signup older than four months as that is the length of a semester:
wp db query "SELECT signup_id FROM wp_signups WHERE registered < DATE_SUB(NOW(), INTERVAL 4 MONTH)" --format=ids | xargs -n 1 wp user signup delete
Then for a scheduled task, we can create a scheduled task to run every month. If the remaining number is small, can make the interval longer, like every two months or so.
Those limits sound good to me. Would be nice to get confirmation from Colin.
Also available in: Atom
PDF