Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top


I have a personal wiki that I use to document code and programming practices and all that good stuff over at StackOverflow. I linked to one of the pages on an SO answer and BOOM! Spam Bots.

Unfortunately, not being prepared for this causes most of my pages now to be filled with links to sites that I will never bother to click on.

My question is, how can I do a mass rollback, instead of individual rollbacks. For instance, is there a way I can delete all changes made by a particular IP address? Or do I have to individually go through each page and roll them back manually.

Thanks for any help!

Edit: It also looks like the MediaWiki rollback system is also unintuitive. The bots made at least 12 changes to each page, and I can't roll it back 12 changes ago.

share|improve this question
Well, just Google it: "mass rollback" turns up this user JS script: – Hello71 Jun 21 '10 at 21:34
up vote 5 down vote accepted

You could always just restore your database from your backup, right?

The revert methods on should work, but as you point out that's not going to fly on a ton of pages.

I would think you could manually go into the MySQL db and purge back to before the spambots, but I'm not sure how that would work.

share|improve this answer

Based on SQL queries by Stan Sokolov, I managed to clean up an awful mess in my wiki - I haven't monitored it for half an year and it was full of spam. I had to clean it from specific date.

If you are going to try same, please backup first - those sql queries can destroy your wiki, kill kittens and cause pregnancy.

In this example, "tr_" is my prefix, "189" is last good page id, "41" is last good user id, and "20130215152547" is first spam entry date.

#Update page state to last good before the date
UPDATE tr_page p SET p.page_latest=( SELECT MAX(r.rev_id) FROM tr_revision r 
WHERE r.rev_page=p.page_id 
AND rev_timestamp <20130215152547) WHERE p.page_id IN 
(SELECT  r2.rev_page FROM tr_revision r2 WHERE rev_timestamp >=20130215152547);

#Update page length to match actual
UPDATE tr_page p SET p.page_len=( SELECT r.rev_len FROM tr_revision r WHERE
r.rev_page=p.page_id AND r.rev_id=p.page_latest );

#Clean up spam revisions

DELETE FROM tr_revision WHERE rev_timestamp >=20130215152547;

#Clear recent changes

DELETE FROM tr_recentchanges WHERE rc_timestamp >=20130215152547;

#Block all new bad users from ever entering wiki with this login
UPDATE tr_user SET
  user_password    = '',
  user_newpassword = '',
  user_email       = '',
  user_token       = ''
WHERE user_id>41;

#Delete pages, staring from the last good id
DELETE FROM tr_page WHERE page_id>189;

#Also, you will need TO clean TABLE tr_pagelinks.
#You will have to do it manually. It's easy, use some editor
#like PHPMyAdmin or SQLyog

#Clean cache

DELETE FROM `tr_objectcache`;
DELETE FROM `tr_querycache`;
DELETE FROM `tr_querycachetwo`;
share|improve this answer
Thank you much! This worked like a charm, except "Random page" still visits the garbage pages. Text like the following is displayed: The revision #0 of the page named "TedderConover162" does not exist. This is usually caused by following an outdated history link to a page that has been deleted. Details can be found in the deletion log. – Lori Oct 23 '15 at 5:45 is an extension that lets you delete all pages created by a user/IP. The JS script mentioned in a comment by Hello71 lets you rollback all changes from a certain user. Used together, it works pretty well.

For your specific case of having 12 changes to each page from multiple bots, I don't know how well that can be handled.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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