Manual:RemoveUnusedAccounts.php/en

Details
removeUnusedAccounts.php is a maintenance script. An unused account is one which has no edits, no deleted edits, no log entries, and no current/old uploads.

You can use to first remove deleted revisions (e.g. after a massive vandalism/spam attack) and run removeUnusedAccounts.php afterwards.

Usage
By default, this script lists unused accounts without deleting them. To delete the unused accounts, run this script with --delete.