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.

Invocation
Running it without any parameter will only list all unused accounts, giving a total at the end. To really delete the accounts, run it again with the parameter:

A full list of options is available with

Warning
By default, this script deletes recently created accounts if they've existed for at least a day and never been used. Use the following option (number of days) to change this.

In some now-obsolete Mediawiki versions (before ignore-touched was introduced), this script deletes all unused accounts regardless of age. To avoid this, apply the patch suggested on the discussion page.