Manual:CleanupSpam.php

Details
cleanupSpam.php file is a maint-scripts>Special:MyLanguage/Manual:Maintenance scripts|maintenance script to cleanup all spam links, which are pointing to a given hostname. The script will use the username, which has been provided in MediaWiki:Spambot_username to attribute the resulting edits to. The script checks each of the respective wikis for external links to the given hostname. In case a page contains a link to that host, the script goes backwards in the history of the page, until the host is no longer on the page. The script will then revert the page to that revision.

Usage
php cleanupSpam.php  [--all] [--delete]