This site recently underwent a major upgrade. Some features may not work or work differently. Please report any issues to User_talk:Admin.

Spam purge

From Galoot-o-pedia
Revision as of 03:52, 24 May 2013 by Admin (Talk | contribs) (1 revision: Import of good pages from Swingley's wiki)

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

I just used the following procedure to flush all the spam and spam users from the Wiki. (See the note below for deleting a more arbitrary set of users)

> begin;
> delete from revision where rev_user > 84;
> delete from mwuser where user_id > 84;
> delete from user_groups where ug_user > 84;
> delete from user_properties where up_user > 84;
> delete from user_newtalk where user_id > 84;
> update page set page_latest = 0;
> update page set page_latest = (select coalesce(max(rev_id), 0) from revision where rev_page = page_id);
> delete from page where page_latest = 0;
> commit;

Instead of using a user_id value, this could be replaced with some sort of long list of bad user IDs. I noticed, for example, that a spammer's user_real_name never contained a space, so I could have generated a list of bad IDs with:

> create table bad_users as select user_id where user_real_name !~ ' ';

Then the above queries would look like:

> delete from revision where rev_user in (select user_id from bad_users);

After deleting stuff, run a few updates:

$ cd maintenance
$ php rebuildall.php
$ php purgeOldText.php