Extension:FlaggedRevs

From MediaWiki.org
Jump to: navigation, search
To learn how to use Flagged Revisions, read the help page on FlaggedRevs.
MediaWiki extensions manual
Crystal Clear action run.png
Flagged Revisions

Release status: stable

Implementation User interface, Special page, User rights, Database, Ajax, API
Description Allows for article content management by "editor" and "reviewer" classes.
Author(s) Aaron Schulz, Joerg Baach
MediaWiki 1.19+
Database changes Yes
License GPL
Download
Added rights

review, autoreview, validate, stablesettings, patrolother, movestable

Hooks used
UserGetRights

ArticleSaveComplete
LinksUpdateConstructed
ArticleUndelete
ArticleMergeComplete
ArticleRevisionUndeleted
ParserClearState
LocalFile::getHistory
BeforeParserFetchTemplateAndtitle
BeforeParserMakeImageLinkObj
ParserAfterTidy
OutputPageParserOutput
ArticleSaveComplete
NewRevisionFromEditComplete
userCan
LogLine
UserRights
GetAutoPromoteGroups
APIGetAllowedParams
APIQueryAfterExecute
MediaWikiPerformAction
BeforePageDisplay
ImagePageFindFile
CategoryPageView
SkinTemplateTabs
ArticleRollbackComplete
ArticleViewHeader
EditPage::showEditForm:initial
PageHistoryPager::getQueryInfo
PageHistoryLineEnding
ImagePageFileHistoryLine
ArticleUpdateBeforeRedirect
DiffViewHeader
EditPage::showEditForm:fields
PageHistoryBeforeList
InitializeArticleMaybeRedirect
HTMLCacheUpdate::doUpdate
ParserTestTables
ArticleDeleteComplete
SpecialPage_initList
UnitTestsList
SpecialNewpagesConditions
SpecialNewPagesFilters
SpecialRecentChangesFilters
SpecialWatchlistFilters
RecentChange_save
BeforeParserFetchFileAndTitle

Translate the FlaggedRevs extension if it is available at translatewiki.net

Check usage and version matrix; code metrics

Phabricator:

Open tasks · Report a bug

The Flagged Revisions extension allows for Editor and Reviewer users to rate revisions of articles and set those revisions as the default revision to show upon normal page view. These revisions will remain the same even if included templates are changed or images are overwritten. This allows for MediaWiki to act more like a Content Management System (CMS).

Download[edit | edit source]

The extension can be retrieved directly from Git [?]:

  • Browse code
  • Some extensions have tags for stable releases.
  • Each branch is associated with a past MediaWiki release. There is also a "master" branch containing the latest alpha version (might require an alpha version of MediaWiki).

Extract the snapshot and place it in the extensions/FlaggedRevs/ directory of your MediaWiki installation.

If you are familiar with git and have shell access to your server, you can also obtain the extension as follows:

cd extensions/
git clone https://gerrit.wikimedia.org/r/p/mediawiki/extensions/FlaggedRevs.git

Setup[edit | edit source]

The examples in the installation instruction are written for modern Unix-like operating systems (especially Linux and Mac OS X) and assume that MediaWiki is installed in the /var/www/mediawiki directory. If you are working on a different family of operating systems, you will need to use commands and file paths appropriate to the operating system.

Follow these steps to install FlaggedRevs:

  1. Ensure that you are running MediaWiki version 1.14 or greater. If not, you will need to upgrade before you can install FlaggedRevs.
  2. Download FlaggedRevs. Choose a version of FlaggedRevs that matches the version of MediaWiki that you are using. For example: If you are running MediaWiki 1.16, download FlaggedRevs 1.16.
  3. Extract the downloaded file to the extensions/FlaggedRevs directory of your MediaWiki installation. For example:
    tar -xzf FlaggedRevs-MW1.16-r75373.tar.gz -C /var/www/mediawiki/extensions
  4. Ensure that image hashes are up-to-date by running the populateImageSha1.php maintenance script.[1] For example:
    php maintenance/populateImageSha1.php
  5. Make sure that the extensions/FlaggedRevs/frontend/modules/ directory is readable by the web server (so that the web server can serve the FlaggedRevs CSS, images and javascript.) For example: Assuming that the web server user does not own the extensions/FlaggedRevs/frontend/modules directory, run:
    chmod o+r extensions/FlaggedRevs/frontend/modules
  6. Enable collection of article review statistics.
    1. Disable on-demand statistic generation. Set $wgFlaggedRevsStatsAge = false; in LocalSettings.php. This will prevent statistics from being generated when articles are accessed (which can lead to poor performance when many articles without current statistics are accessed concurrently).
    2. Set up scheduled statistics generation. Create a cron job to run extensions/FlaggedRevs/maintenance/updateStats.php at a regular interval. Run time php updateStats.php to see how long the script takes to run and set your cron jobs interval appropriately. For example, to create a cron job that runs updateStats.php as user www-data every hour:
      echo "@hourly php /var/www/mediawiki/extensions/FlaggedRevs/maintenance/updateStats.php" | crontab -u www-data
  7. Enable FlaggedRevs by adding the following line to LocalSettings.php
    require_once("$IP/extensions/FlaggedRevs/FlaggedRevs.php");
    
  8. Update MediaWiki's database schemas by running php /var/www/mediawiki/maintenance/update.php.
  9. Promote users to be reviewers. After FlaggedRevs is first installed, no user can see the reviewer's widget. To fix this, login as a wiki bureaucrat and go to Special:UserRights, then grant review rights to one or more users. Reviewers will see the reviewer's widget on the bottom of an editable page.

Notes[edit | edit source]

  1. If the hash table is up-to-date, images can be referenced by using their hashes rather than by a name/timestamp pair. In the future, image moves may be supported by MediaWiki, which will break references that used name/timestamp pairs.

Wikimedia Server Installation[edit | edit source]

See also wikitech:Heterogeneous deployment#Install a new extension on a wiki and wikitech:How to do a schema change.

Instructions for Wikimedia projects community: m:Flagged Revisions#Enabling.

These notes are specific to the Wikimedia servers, and are probably not applicable to your setup.

cd /a/common/php-1.23wmf5
mwscript sql.php --wiki=metawiki extensions/FlaggedRevs/backend/schema/mysql/FlaggedRevs.sql
cd ..
sync-dir wmf-config
touch wmf-config/InitialiseSettings.php
sync-common-file flaggedrevs.dblist
sync-dir wmf-config

Configuration[edit | edit source]

User rights and user groups[edit | edit source]

By default, nobody can review anything, so the first step is to set up user rights.

User groups User rights
reviewer validate
review
editor
autoreview
unreviewedpages

User rights[edit | edit source]

FlaggedRevs creates the following new user rights:

  • review – user can review revisions
  • validate – user can review revisions and can set all tags to all levels
  • autoreview – any new revisions made by the user are automatically marked as sighted
  • unreviewedpages – user can view Special:UnreviewedPages
  • stablesettings
  • patrolother
  • movestable

User groups[edit | edit source]

FlaggedRevs creates the following new user groups:

  • editor – receive autoreview, review, unreviewedpages, plus the standard Mediawiki user rights autoconfirmed, editsemiprotected
  • reviewer – receive autoreview, review, unreviewedpages, validate, plus the standard Mediawiki user rights autoconfirmed, editsemiprotected
  • autoreview – receive autoreview

How to assign user rights[edit | edit source]

User rights can be assigned in two ways:

  • Assigning rights to user groups
Assign these user rights to existing user groups in LocalSettings.php:
$wgGroupPermissions['sysop']['review'] = true; //allow administrators to review revisions
  • Assigning rights to specific users
Manually add user accounts to the appropriate groups via Special:UserRights.
By default:
  • Bureaucrats can add/remove Reviewers
  • Administrators can add/remove both Autoreviewers and Editors.

Basic settings[edit | edit source]

FlaggedRevs.php comes with a number of configurable variables. These should be configured in LocalSettings.php.

  • $wgFlaggedRevsNamespaces – Sets what namespaces may be subject to the review process. This is an array of integers. Look at the beginning of includes/defines.php to see what integer the default namespaces map to and use the defined constants for readability.
  • $wgFlaggedRevsTags – Sets the tags and their three settings: 'levels', 'quality', and 'pristine'
Definition
$wgFlaggedRevsTags is an associative array with keys corresponding to each tag name and values that are arrays of the three settings 'levels', 'quality', and 'pristine':
  • 'levels' controls the number of review levels,
  • 'quality' decides what level the tag must be for a revision to be 'quality'
  • 'pristine' decides what level the tag must be for a revision to be 'pristine'
Labeling
  • Each tag can be labeled editing the page MediaWiki:revreview-<tag-name>.
  • Each tag level can be labeled editing the page MediaWiki:revreview-<tag-name>-<level-number>.
Example
Suppose one wants to have "accuracy", "depth", and "tone" tags, with 3 levels each.
The admins also want revisions with at least "accuracy" and "depth" of the 2nd levels to count as "quality". The following settings will do that:
$wgFlaggedRevsTags = array(
	'accuracy' => array( 'levels' => 3, 'quality' => 2, 'pristine' => 4 ),
	'depth'    => array( 'levels' => 3, 'quality' => 2, 'pristine' => 4 ),
	'tone'     => array( 'levels' => 3, 'quality' => 1, 'pristine' => 4 ),
);
By default, the tags are labeled as they are set in the $wgFlaggedRevsTags array. In this example this means the tags appear exactly as 'accuracy', 'depth' and 'tone'.
To show tags for example as their capitalized name, the admins have to edit these pages with the shown content:
tag labeling page content
accuracy MediaWiki:revreview-accuracy Accuracy
depth MediaWiki:revreview-depth Depth
tone MediaWiki:revreview-tone Tone
To label the tag levels, the admins have to create these pages with the shown content:
tag level labeling page content
accuracy 0 MediaWiki:revreview-accuracy-0 Low
1 MediaWiki:revreview-accuracy-1 Medium
2 MediaWiki:revreview-accuracy-2 High
depth 0 MediaWiki:revreview-depth-0 Superficial
1 MediaWiki:revreview-depth-1 Sufficient
2 MediaWiki:revreview-depth-2 Detailed
tone 0 MediaWiki:revreview-tone-0 Weak
1 MediaWiki:revreview-tone-1 Good
2 MediaWiki:revreview-tone-2 Excellent
The resulting setup will be:
tag names level names
Accuracy Low Medium High
Depth Superficial Sufficient Detailed
Tone Weak Good Excellent


  • $wgFlaggedRevsOverride – Whether the stable version is the default content for pages.
Note Note: Individual pages can be configured to have the stable or draft version as the default content by administrators.
  • $wgFlagRestrictions – An array with keys corresponding to each flag type, and values that are arrays of rights and how high users with it can rate the flags (integral tag level).
Example
$wgFlagRestrictions = array(
	'accuracy' => array( 'review' => 1 ),
	'depth'	   => array( 'review' => 2 ),
	'style'	   => array( 'review' => 3 ),
);
  • $wgFlaggedRevsWhitelist – Array of string titles. These titles are pages that are exempt from FlaggedRevs. They are unreviewable and have no flagging UI. Replace ' ' with '_' in titles (e.g. "Main page" -> "Main_page").

User interface[edit | edit source]

  • $wgSimpleFlaggedRevsUI – When enabled, a simpler, icon based UI is used. Does not affect the tags shown in edit mode.
  • $wgFlaggedRevsLowProfile – This setting hides the review status box/bar for pages that are reviewed in their latest version. Explanatory text is also removed from some places.

Workflow[edit | edit source]

  • $wgFlaggedRevsExceptions – Makes users in these groups see the current/draft revision by default.
  • $wgFlaggedRevsAutoReview – If enabled, every edit by a user with 'autoreview' rights is automatically reviewed upon save. There is no need to hit the "submit review" button. This feature requires that the previous revision was also reviewed; otherwise, auto-review will not occur.
  • $wgFlaggedRevsTagsAuto – If wgFlaggedRevsAutoReview is enabled, this settings controls how high each tag can be auto-reviewed. If allowed, tags will be auto-reviewed to the same level the previous revision tags were. This is an associative array; each key is a tag and each value is a tag level.
Example
$wgFlaggedRevsTagsAuto = array(
	'accuracy' => 1, 'depth' => 1, 'style' => 1
);
Note Note: Changes in templates and images are auto-reviewed (per-page). This could possibly cause bad versions to be reviewed. Users should be encouraged to use preview or review the page after saving. You may want to set $wgNamespaceProtection[NS_IMAGE] and $wgNamespaceProtection[NS_TEMPLATE] as array('editor') or array('autoconfirmed');

Automatic user promotion[edit | edit source]

  • $wgFlaggedRevsAutopromote – An array with keys for days, edits, time spacing, benchmarks, emailconfirmed, recent content page edits, total content edits, content pages edited, edit summaries used, IP uniqueness, and userpage existence as keys. The values correspond to how many days/edits are needed for a user account to be autopromoted to Editor status and whether they must be emailconfirmed and have a user page do so. The user must have at least X edits that are Y or more days apart, where X is the number of benchmarks and Y is the time spacing. Set this variable to false to disable this entirely.
    • Note Note: If a user has their Editor rights removed, they will not automatically be re-granted (the editor status log is checked for revocations).
    • Note Note: Some of these counts are not retroactive, so you may notice a delay in promotions.
Example
For $wgFlaggedRevsAutopromote, one might have:
$wgFlaggedRevsAutopromote['days'] = 60; # days since registration
$wgFlaggedRevsAutopromote['edits'] = 150; # total edit count
$wgFlaggedRevsAutopromote['excludeDeleted'] = true; # exclude deleted edits from 'edits' count above?
$wgFlaggedRevsAutopromote['spacing'] = 3; # spacing of edit intervals
$wgFlaggedRevsAutopromote['benchmarks'] = 15; # how many edit intervals are needed?
$wgFlaggedRevsAutopromote['recentContentEdits'] = 10; # $wgContentNamespaces edits in recent changes
$wgFlaggedRevsAutopromote['totalContentEdits'] = 30; # $wgContentNamespaces edits
$wgFlaggedRevsAutopromote['uniqueContentPages'] = 10; # $wgContentNamespaces unique pages edited
$wgFlaggedRevsAutopromote['editComments'] = 5; # how many edit comments used?
$wgFlaggedRevsAutopromote['email'] = true; # user must be emailconfirmed?
$wgFlaggedRevsAutopromote['userpageBytes'] = 0; # if userpage is needed, what is the min size?

Advanced[edit | edit source]

See FlaggedRevs.config.php for a complete list of configuration options (with some explanatory comments). Be sure to change only localsettings.php to set configuration options rather than editing this file.

To have a wiki where non-users can only see the stable version of articles, see /Restricting unapproved revisions.

Use[edit | edit source]

See also: Help:FlaggedRevs

Approving pages[edit | edit source]

Users with some level of review status will have a small rating form on page view (at the bottom of the page) and diffs (at the top of the page) that lets them review revisions. Each tag must at least meet the minimal level of approval. Users should look at the whole page, included templates and images, before reviewing. The (diff to stable) link is very useful for speeding up this process.

A user cannot review a page he cannot edit. They cannot lower the level of a revision from a level they cannot set. Blocked users cannot do anything.

Revreview2.png

At Special:StableVersions, you can list out all of the reviewed revisions for a certain page or view reviewed revisions.

Stableversions.PNG

Upkeep[edit | edit source]

At Special:UnreviewedPages, there is a list of pages that have not yet been reviewed, for Editors only. A namespace must be selected and an optional category filter is also present.

Unreviewedpages.PNG

At Special:OldReviewedPages, there is a list of pages that have been reviewed, but have edits pending. This is for Editors only. An optional category filter is also present.

OldReviewedpages.PNG

Pages that cannot be reviewed can still be patrolled for anti-vandalism purposes by Editors to see what has been checked already.

A list of reviewed pages at the main review levels can be found at Special:ReviewedPages.

Reviewedpages.png

Logging[edit | edit source]

All relevant actions are permanently logged, so everything can be tracked and overseen properly.

Also, a new page, Special:QualityOversight shows only flaggings log entries related to quality revisions. This is useful if the main log is too flooded with page "sightings".

Notes[edit | edit source]

  • $wgUseRCPatrol is enabled with the extension. Patrolling of reviewable pages is disabled, but flagged revisions are marked as patrolled in Recent Changes. This will mean that the only way to patrol a reviewable revision is to flag it. Non-reviewable pages still behave as normal (depending on site patrol settings).
  • Sysops can change whether quality revision have precedence or whether the stable version is shown by default for specific pages. To disable this, add $wgGroupPermissions['sysop']['stablesettings'] = false; to LocalSettings.php.
  • Page links, category, image, template, language, and external links are still based on the current version of pages.
  • Users cannot move pages they cannot review. This is deliberate; see bugzilla:13994. To work around this, add $wgGroupPermissions['autoconfirmed']['movestable'] = true; to LocalSettings.php
  • You can demote Editors either temporarily by blocking them or permanently via Special:UserRights. An extra demotion log item will appear for tracking purposes.

API[edit | edit source]

FlaggedRevs adds API modules for reviewing revisions and configuring "stabilization" of pages, a module for retrieving flag configuration, and three list modules corresponding to the special pages for reviewed pages, unreviewed pages and "old" reviewed pages.

action = review[edit | edit source]

Reviews a page.

Parameters
  • revid: The revision ID for which to set the flags
  • token: An edit token retrieved through prop=info
  • comment: Comment for the review (optional)
  • flag_accuracy: Set the flag named "accuracy" to the specified value; (replace "accuracy" with the flag name to set another flag)
Example

Review revision 12345

action = stabilize[edit | edit source]

Changes page stabilization settings.

Parameters
  • title: Title of page to be stabilized
  • reason: Reason for stabilization
  • expiry: (Deprecated?) Stabilization expiry. Default: infinite
  • review: Whether to auto-review the page
  • watch: Whether to watch the page
  • token: An edit token retrieved through prop=info
  • For protection-like configurations ($wgFlaggedRevsProtection=true):
    protectlevel: The right users must have in order for their edits to not require review.
  • Otherwise ($wgFlaggedRevsProtection=false):
    default: Default revision to show (latest | stable)
    precedence: Which stable revision should be shown (pristine | quality | latest). Default: quality
    autoreview: Restriction level for the 'autoreview' right (sysop | none). Default: none
Example

Configure the page "Foo" such that only quality revisions are shown by default

action = flagconfig[edit | edit source]

Shows information about review flag configuration.

The following parameters are returned for each tag:

  • name: the name of the flag
  • levels: the number of possible levels the flag has (not counting the "unreviewed" level)
  • tier2: level the flag must be for the revision to be considered "quality"
  • tier3: level the flag must be for the revision to be considered "pristine"

The displayed name for each flag and the different level names for each flag are MediaWiki messages, so can be set and retrieved through the appropriate page; for example the name for the first level of the "accuracy" flag is located at MediaWiki:revreview-accuracy-1.

Example

Retrieve flag configuration

list = reviewedpages[edit | edit source]

Lists pages that have been reviewed.

Parameters
  • rpstart: Start listing at this page id.
  • rpend: Stop listing at this page id.
  • rpdir: In which direction to list.
  • rpnamespace: The namespaces to enumerate.
  • rpfilterredir: How to filter for redirects
  • rpfilterlevel: How to filter by quality (0=sighted,1=quality)
  • rplimit: How many total pages to return.
Example

List "sighted" pages in main namespace

list = unreviewedpages[edit | edit source]

Lists pages which have never been reviewed.

Parameters
  • urstart: Start listing at this page title.
  • urend: Stop listing at this page title.
  • urnamespace: The namespaces to enumerate.
  • urfilterredir: How to filter for redirects
  • urfilterlevel: How to filter by quality (0=sighted,1=quality)
  • urlimit: How many total pages to return.
Example

List pages in the main namespace that have not been "sighted"

list = oldreviewedpages[edit | edit source]

Lists pages that have at some point been reviewed, but for which the most recent revision is not reviewed.

Parameters
  • orstart: Start listing from this timestamp
  • orend: Stop listing at this timestamp.
  • ordir: In which direction to list.
  • ornamespace: The namespaces to enumerate.
  • orfilterredir: How to filter for redirects
  • orlimit: How many total pages to return.
Example

List pages in the main namespace with recent unreviewed revisions

Limitations[edit | edit source]

  • Transclusions across wikis are not stabilized
  • External images (aside from Commons) are not stabilized
  • Metatemplates that conditionally include other templates may have the condition change between the time a reviewer loaded a page and when they reviewed it. Therefore, there would be no pointers to the revision id for this different template to load from, making it blue linked. You will be notified if this happens during review.

Uninstalling[edit | edit source]

  1. Remove the include line from LocalSettings.php
  2. Drop the tables in FlaggedRevs.sql.
  3. Drop the columns page_ext_reviewed, page_ext_quality, and page_ext_stable, and the index ext_namespace_reviewed from the page table (if they exist; only older versions of FlaggedRevs used these)
  4. Run maintenance/refreshLinks.php from the command line to flush out the stable version links
  5. Run maintenance/rebuildFileCache.php 0 overwrite from the command line if you use $wgFileCache

Testing platforms[edit | edit source]

See also[edit | edit source]

External links[edit | edit source]

Licensing[edit | edit source]

© GPL, Aaron Schulz, Joerg Baach, 2007

Language: English  • Deutsch • italiano • 日本語