Purge spam revisions from mediawiki database permanently

From LVSKB
Revision as of 16:30, 23 February 2008 by Wensong (Talk | contribs) (New page: == Introduction == Spam programs have posted spam links on our wiki for a while. Although SpamBacklist extension was installed, "php cleanup.php" was to revert the spam links. After Confi...)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Introduction

Spam programs have posted spam links on our wiki for a while. Although SpamBacklist extension was installed, "php cleanup.php" was to revert the spam links. After ConfirmEdit extension was installed, spam programs are difficult to post spam automatically. However, those spam links are still in page history, and in database.

It's really annoying to keep those spams in the database, which occupy a lot of space. And, search engine crawlers can still reach those spam links in page history, those links are connected to *bad* sites, I think that it could lower page rank of our own web pages in search engines.

Working Log

Finally, spent a couple of hours hours purging all spams in page history in LVSKB manually and permanently.

Mediawiki Administrator Help has instructions to delete spam revisions manually.

First, search all the history that contains spam revisions, there are many different approaches, for example

select old_id, old_title from text where old_text like '%wyger.nl%';
select * from revision where rev_text_id = 309;
select * from page where page_id = 957;

the delete spam history manually. Repeat this procedure if you can find more spam revisions.

Second, purge them into database permanently mysql> select count(*) from archive; mysql> delete from archive; If you do not want to see deletion log, do mysql> describe logging; mysql> select * from logging where log_id >= 1710 and log_type = 'delete'; mysql> delete from logging where log_id >= 1710 and log_type = 'delete'; Run "php purgeOldText.php" to purge text, which would save a lot of disk space.

[wensong@dragon maintenance]$ php purgeOldText.php
 
Purge Old Text
 
Searching for active text records in revisions table...done.
Searching for active text records in archive table...done.
Searching for inactive text records...done.
4263 inactive items found.
[wensong@dragon maintenance]$ php purgeOldText.php --purge
 
Purge Old Text
 
Searching for active text records in revisions table...done.
Searching for active text records in archive table...done.
Searching for inactive text records...done.
4263 inactive items found.
Deleting...done.

Run "php rebuildrecentchanges.php" to rebuild recent changes page

Just log this whole procedure for future reference.