Extension:Approved Revs

Description
Approved Revs is an extension that lets administrators mark a certain revision of a page as "approved". The approved revision is the one displayed when users view the page at its main URL.

Approved Revs was designed to be a simple, lightweight alternative to the FlaggedRevs extension. FlaggedRevs is a very feature-rich, heavy-duty extension that provides not just revision approval but also reviewing and related features; it defines 4 user rights, 3 user groups, 16 global variables, 2 log types, 5 special pages and 8 database tables. By contrast, Approved Revs defines 2 user rights, 1 global variable, 1 log type, 1 special page and 1 database table. If you're running a large-scale wiki like, say, Wikipedia, where the decision of which revision to show as the "official" one has to be made by, or at least accepted by, many people, FlaggedRevs is most likely the right tool to use. However, if you're running a small- or medium-scale wiki, with just a few administrators, Approved Revs may be the more appropriate solution.

Approved Revs does not handle pages in the File/Image or Category namespaces, due to their implementation in MediaWiki.

Even if a revision is approved, most extensions that retrieve the contents of pages will still get the last revision, and not the approved one (if the two are different). Extensions that get specific data from pages, however, such as Semantic MediaWiki and DPL, will, fortunately, display the correct (i.e., approved) data.

Download
You can download the Approved Revs code in either one of these two compressed files:


 * approved_revs_0.1.tar.gz
 * approved_revs_0.1.zip

You can also download the code directly via SVN from the MediaWiki source code repository, at http://svn.wikimedia.org/svnroot/mediawiki/trunk/extensions/ApprovedRevs/. From a command line, you can call the following:

svn checkout http://svn.wikimedia.org/svnroot/mediawiki/trunk/extensions/ApprovedRevs/

Installation
To install this extension, create an 'ApprovedRevs' directory (either by extracting a compressed file or downloading via SVN), and place this directory within the main MediaWiki 'extensions' directory. Then, in the file 'LocalSettings.php', add the following line:

You will also need to install a database table for this extension, also called "approved_revs". You can do this in one of two ways: either run the script "update.php" in MediaWiki's /maintenance directory, or call the SQL directly in your database - you can find it in the file ApprovedRevs.sql.

There are two user rights defined for Approved Revs: 'approverevisions' and 'viewlinktolatest':


 * 'approverevisions' is the permission to approve and unapprove revisions of pages. By default it is given to all members of the 'sysops' group.
 * 'viewlinktolatest' is the "permission" to see a note at the top of pages that have an approved revision, explaining that what the user is seeing is not necessarily the latest revision. By default it is given to everyone (i.e, '*').

Usage
Once the extension is installed, anyone with the 'approverevisions' permission will see a link that reads "(approve)" on each row of a page history page. Clicking on that link will set that revision as the approved one. If you then go back to the history page, you will see an "approve" link next to every other revision, along with an "unapprove" link for the approved revision; the approved revision's row will also have a star next to it. Clicking "approve" for any other revision will re-set the approval to that revision; while clicking "unapprove" will mean that there will no longer be an approved revision for this page.

Users without an 'approverevisions' parameter will see nothing special in the history page, other than a star icon on the approved revision's row.

Revision approvals and unapprovals get stored in the 'approval' log.

The page "Special:ApprovedPages" will show a list of all pages that have an approved revision.

Bugs and feature requests
Send any bug reports and requests to Yaron Koren, at yaron57 -at- gmail.com.

Contributing patches to the project
If you found some bug and fixed it, or if you wrote code for a new feature, please create a patch by going to the "ApprovedRevs" directory, and typing:

svn diff > descriptivename.patch

Then send this patch, with a description, to Yaron Koren.