User:Jamesmontalvo3/Approved Revs/Version 0.8

Approved Revs is an extension that lets specified users 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. Files can also be marked as "approved", and the approved version of files will be shown when included in pages.

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, 15 global variables, 3 log types, 11 special pages and 9 database tables (by contrast, Approved Revs defines 1 user right, no user groups, TBD global variables, 1 log type, 1 special page and 2 database tables). 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 people with approval rights, Approved Revs may be the more appropriate solution.

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)Examples?. 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 v0.8 code, in .zip format, here.

You can also download the code directly from via Git from Github. From a command line, you can call the following:

To view the code online, including version history for each file, go here.

Semantic Bundle...

Installation
To install this extension, create an 'ApprovedRevs' directory (either by extracting a compressed file or downloading via Git), 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 two database tables for this extension, called "approved_revs" and "approved_revs_files". 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 and ApprovedRevs_Files.sql.

If you're using version 0.6.2 or later, MediaWiki's text search (i.e., the Special:Search page) should correctly find pages based on their approved revision, if they have one. However, if you're also using MediaWiki 1.19 or earlier, the display of search results will still show the page's latest revision. To get this working correctly, you will have to apply a small patch to the core MediaWiki code - you can see it here.

Finally, there is one user right defined for Approved Revs: '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, '*'). You can modify the set of users who have this permission. For example, to have the "view most recent revision" link show up only for administrators, you could add the following, below the inclusion of Approved Revs:

In Approved Revs versions before 0.7.0, 'approverevisions' was the permission to approve and unapprove revisions of pages. That permission has been replaced by the MediaWiki:Approvedrevs-permissions page.

List configuration global variables here, with links to sections below:

Authors
Approved Revs was written by Yaron Koren. Important code contributions were also made by Raimond Spekking, Siebrand Mazeland, Jeroen De Dauw and James Montalvo.

Usage
Once the extension is installed, anyone with sufficient permissions per the MediaWiki:Approvedrevs-permissions page 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 approval permissions on a page will not see approve/unapprove links in page's history, other than a star icon on the approved revision's row.

By default, if a user who has approval permissions on a page makes an edit to that page, and that page already has an approved revision, that edit, i.e. the latest revision of the page, gets automatically marked as approved. By contrast, if a page has no approved revision (this of course includes new pages), automatic approvals will not be applied.

You can eliminate automatic approvals, thus requiring that every approval has to be done manually, by adding the following to LocalSettings.php below the inclusion of Approved Revs:

Conversely, if you set "$egApprovedRevsBlankIfUnapproved" to true in LocalSettings.php (see below), every edit made by a user with approval permissions becomes approved - even edits to pages that don't have an approved revision.

Manual revision approvals and unapprovals get stored in the 'approval' log; though approvals that happen automatically, as a result of someone with approval power editing a page, do not.

Special:ApprovedRevs page
Approved Revs defines a special page, "Special:ApprovedRevs" which can show eight separate lists:
 * 1) all pages that have an approved revision
 * 2) all files that have an approved revision
 * 3) all pages whose approved revision is not their latest revision
 * 4) all files whose approved revision is not their latest revision
 * 5) all pages that should have an approved revision, but do not
 * 6) all files that should have an approved revision, but do not
 * 7) all pages that have an approved revision, but should not based on MediaWiki:Approvedrevs-permissions (grandfathered pages)
 * 8) grandfathered files

For the fifth and sixth list, of pages and files with no approved revision, you can optionally include a link for each page to mark that page's latest revision as approved. To include such links, add the following to LocalSettings.php:

Displaying unapproved pages as blank
If you want to, you can have pages that have no approved revision show up as blank - users will still be able to see all the revisions if they click on the "history" tab, but the main display will be a blank page. To do that, just add the following line to LocalSettings.php, anywhere after the inclusion of Approved Revs:

Setting pages as approvable
Some wiki pages can have their revisions approved, while others cannot; this is determined by the MediaWiki:Approvedrevs-permissions page, which is new with v0.7.0.

The global variable,, has been removed.

By default, six namespaces are approvable: Main (the main namespace), User (user pages), Template (templates), Help (help pages), Project (the project namespace, which usually has the same name as the wiki) and File (the file namespace). You can add or subtract editable namespaces to this set by editing MediaWiki:Approvedrevs-permissions. It is not recommended that you add the Category or MediaWiki namespaces to this array, because, due to their special implementation in MediaWiki, approvals will not work correctly on those pages.

For the File namespace, file pages will not be approvable even if you add "File" to MediaWiki:Approvedrevs-permissions (as is the default). In other words, you will not be able to go into the history of the file and add approvals the way you do on other pages. Instead, you can only approve the files themselves, which is done right on the File page.

Additionally:
 * pages of a particular category can be made approvable. Note to be careful about adding/removing categories and approving pages without the category
 * individual pages can be made approvable

Individual pages not defined within MediaWiki:Approvedrevs-permissions can also be made approvable, by adding the __APPROVEDREVS__ magic word anywhere within the page, but this feature is deprecated and should not be used any longer.

Approving User pages
If "User" is added to the Namespace permissions on MediaWiki:Approvedrevs-permissions (which is the default), all users will be able to approve revisions on their own user pages.


 * Note: "Creator" permission

Marking all pages as approved
For pages that do not yet have an approved revision, you may want to automatically approve their latest revision, as a way to quickly initialize their content. For that, you can use the command line script 'ApprovedRevs/maintenance/approveAllPages.php'. This script approves the latest revision of all pages that can be approved but do not have an approved revision.

Version history
Approved Revs is currently at version 0.8.0. See the entire version history.

Known issues

 * When using MediaWiki 1.19, the "approve" link does not show up for all revisions in the history page, when viewing the page with the Google Chrome or Safari browsers.

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 either do a Git commit for it, or create a patch by going to the "ApprovedRevs" directory, and typing:

git diff > descriptivename.patch

If you create a patch, please send it, with a description, to Yaron Koren.

Translating
Translation of ApprovedRevs is done through translatewiki.net. The translation for this extension can be found here. To add language values or change existing ones, you should create an account on translatewiki.net, then request permission from the administrators to translate a certain language or languages on this page (this is a very simple process). Once you have permission for a given language, you can log in and add or edit whatever messages you want to in that language.