Skip to content


MediaWiki maintenance – removing deleted revisions

Ok, this is something which was a bit hard to find, basically because “deleting deleted stuff” isn’t really an easy search… So here we go, how to definitely remove from the database some useless junk, aka deleted revisions and deleted files.
As usual, we used the latest MediaWiki version available at time of writing, which is version 1.12.0.

Extra-requirements (eg, what’s needed apart from the normal stuff to run MediaWiki): php command line (for php5, the package is php5-cli).

1. Make A BACKUP of your database and image folder first (NB: in the images folder, you don’t need to backup the “temp” and “thumb” directories)

2. Go, with the console, to the maintenance folder of the wiki.

3. To erase the deleted files, type:
php deleteArchivedFiles.php --delete
If you get messages of files not found in group ‘deleted’, it probably means that you already deleted these files manually. In this case you need to finish the job by emptying the [your_database_prefix]filearchive table manually (eg with phpMyAdmin).

4. To erase the deleted revisions, type:
php deleteArchivedRevisions.php --delete
(NB: this basically empties the [your_database_prefix]archive table)
Then, you must delete also the *text* of these revisions, using the following:
php purgeOldText.php --purge

That’s all, don’t forget to browse around your wiki a bit to make sure everything is fine. Also, note that this doesn’t clean up the deletion log. So when trying to re-create a page that was previously deleted and the erased as above, you’ll still have a “restore” option. But the restoration page will have no revisions and/or files available for restoration.

Posted in MediaWiki, web development.


0 Responses

Stay in touch with the conversation, subscribe to the RSS feed for comments on this post.



Some HTML is OK

or, reply to this post via trackback.

Sorry about the CAPTCHA that requires JS. If you really don't want to enable JS and still want to comment, you can send me your comment via e-mail and I'll post it for you.

Please solve the CAPTCHA below in order to fight spamWordPress CAPTCHA