Manual:RemoveUnusedAccounts.php

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

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