2 days ago I did the mistake of updating my MediaWiki site, without transfering my old user management plugin.

My site was shut down from my host for mail spam and there are now over 14 million new pages and so many users that i can't go through and delete them by hand.

I tried using the Nuke extention, but after deleting 150000 items it cant do pattern search, giving the error "There are no new pages in recent changes."

Is there a way to delete all new pages and users created within x number of days or by filtering the Nuke extention by date?

  • 2
    A easy way would be to restore from a daily backup... but I'm guessing you don't have one.... Mar 22, 2015 at 12:12
  • Bybe's advice may be the only sane option you have short of going through each account/post. I assume that the wiki schema has clues such as account/post creation dates or some metric that will help. You may really have to begin digging deep. Or simply cut your losses and restore from back-up.
    – closetnoc
    Mar 22, 2015 at 15:30
  • I took a quick look at the schema. Unless you are fairly comfortable with database queries against a schema and can determine how the time-stamps are handled [binary(14)] and can write code, you are far better off restoring from back-up. If you are skilled in using SQL queries and determining the values of the time stamp, then you should be able to peel back the damage. However, I do warn you that this is significantly detailed work. You should at least see what posts and users where created within the past couple of days.
    – closetnoc
    Mar 22, 2015 at 16:54
  • These are the schema create statements: git.wikimedia.org/blob/mediawiki%2Fcore.git/HEAD/… and this is a view of the schema: upload.wikimedia.org/wikipedia/commons/f/f7/… I post this in case you can take on this challenge. Otherwise, I suggest a restore. I cannot see too many options.
    – closetnoc
    Mar 22, 2015 at 16:57
  • There are various ways to delete lots of pages, but for millions, they will take a while. Restoring from a dump seems to be by far the best solution.
    – Tgr
    Mar 22, 2015 at 23:31

1 Answer 1


See the comments, but if you're set on this solution you can use deleteBatch.php.

Assuming the timing of the attack is what you said, it would be something like:

mysql -e "select page_title from page where page_touched between 20150319000000 and  20150322000000 into outfile '/tmp/pagelist.csv'"
php maintenance/deleteBatch.php  --conf LocalSettings.php -r "Mass deletion of spam attack pages." /tmp/pagelist.csv

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.