Extension:SpecialDeleteOldRevisions

What is this extension good for?
This extension deletes permanently all old revisions of the specified (or all) article(s).

What it does not do: You can not choose a certain revision (check Oversight for that functionality).

This extension adds a special page accessible to sysops only.

Usage
You need to be logged in as sysop. Under special pages you will find the Delete old revision page in the sysop section.


 * page: specify the pages to be deleted, % for all pages.
 * namespace: specify the namespace for the articles, check all for all namespaces.
 * up to date: specify the date of the revisions. All revision before and on that date will be deleted.
 * Delete archived articles: If this is checked all already deleted articles will be permanently deleted.

This extension will clear the tables: archive, page, revision, text, recent changes and logging.

Example: If you want to delete all unused MediaWiki-Texts (which have been deleted after upgrading to 1.8), choose namespace MediaWiki and article name: %. The database will be significantly smaller.

If using MySQL you need to optimize the tables afterwards, you can do that with phpMyAdmin.

Installation
You can now access the Special:DeleteOldRevisions page as a sysop.
 * 1) Make a file "SpecialDeleteOldRevisions.php" in /extensions with the code on this page.
 * 2) Add the following lines near the end in the LocalSettings.php file:

Code from 1.7.x
This code has been tested on MediaWiki 1.9.2. Warning: This code has extended functionality and is still in beta stage. Test in a safe environment and backup your DB!

Download here.

Please use download, it is up to date.

Code till 1.6.x
Note: This code is outdated, it does not have the article selection.

This code has been tested on MediaWiki 1.6.7.

Note: Won't work on MediaWiki 1.7 (Call to deprecated (v1.7) User::isSysop method)
 * Fix: If you find the function User::isSysop in includes/User.php, you will see the new function, albeit commented out. (it is User::isAllowed('protect') on my version.)

History:
 * 20 June 2006 -- Version 1.0 -- First release.

Optimizing tables
After the revisions have been deleted, optimize all tables by checking them all in myPhpAdmin and then in the "With selected:" drop down at the bottom of the page, choose "optimize".

Known issues
If pages have single quotes in their titles, an error will result. This can be fixed:
 * In the code (near line 270), replace
 * $arc[] = "'" . $row->page_title . "'";
 * with
 * $arc[] = $dbw->addQuotes($row->page_title);

This will temporarily fix the bug people are currently stumbling