Feb18

Written by:David Aldridge
2/18/2011 2:42 PM 

The simplest answer to this is to restore a backup of the database.  If however you don't have one then this is how to clean up the database.

The core of the database resides in four tables - user, revision, page and text.  Revision can be considered the core of the core, as the others link through it to relate to one another.

Users create revisions which have a page and text associated with them.

To find all of the pages and revisions created by a user, you can use the following SQL commands:

select user_id from user where user_email='a@b.com';

This will give you the internal user_id number referenced in the revision, page and text tables to allow you to remove what that user added.

First remove the text:

delete from text where old_id in (select rev_text_id from revision where rev_user=user_id);

Where user_id is the one you got from the select statement above.

Then remove the pages:

delete from page where page_id in (select rev_page from revision where rev_user=user_id);

Now remove the revisions:

delete from revision where rev_user=user_id;

And finally remove the user themselves:

delete from user where user_id=user_id;
 

Tags:

1 comment(s) so far...

Users activity and accounts cleaner for MediaWiki

This shell script may be useful too:

www.actiu.net/mediawiki

By CleanMediawiki on  11/4/2014 6:24 AM

Your name:
Your email:
(Optional) Email used only to show Gravatar.
Your website:
Title:
Comment:
Security Code
Enter the code shown above in the box below
Add Comment  Cancel 
You must be logged in and have permission to create or edit a blog.