Extension:SpecialDeleteOldRevisions

If you use mediawiki &gt; 1.12, consider using SpecialDeleteOldRevisions2 extension instead. It is curently maintained and fixed for latest wiki release, and you won't have to apply all patches manually.

This extension permanently deletes all old revisions of all article(s). If you are using 1.7 or newer you can alternatively specify which articles, otherwise it deletes the old revisions of all articles.

What it does not do: You can not choose which revisions to keep and which to delete (See Oversight for this).

This extension adds a special page accessible to sysops only.

Usage (1.7 and newer)
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.

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

You next get a page with a single button to Delete. This will delete all revisions from all pages.

Installation

 * 1) Create a file "SpecialDeleteOldRevisions.php" in your wiki /extensions folder using the code on this page.
 * 2) In the LocalSettings.php file, add the following lines near the end:


 * }


 * Syops can now access the Special:DeleteOldRevisions page.

Code from 1.13.2
To use this extension in 1.13.2, do the following: Now you can download it here
 * Create the directory "SpecialDeleteOldRevisions"
 * Place the HTMLForm.php from 1.11.2, replacing includes/HTMLForm.php
 * Edited line with quotes problem

You just need to put lines $wgGroupPermissions['sysop']['DeleteOldRevisions'] = true; include_once('extensions/SpecialDeleteOldRevisions/SpecialDeleteOldRevisions.php'); in LocalSettings.php - and everything will work fine.

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 database.

Download here.

Please use download, it is up to date.

Code through 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 in myPhpAdmin after deletion
After the revisions have been deleted, optimize all tables by checking all tables in myPhpAdmin. 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 on.