r68618 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r68617‎ | r68618 | r68619 >
Date:06:23, 27 June 2010
Author:aaron
Status:ok
Tags:
Comment:
* Re-organized config vars a bit & improved comments
* Clarified $wgFlaggedRevsAutoReviewNew behavior wrt $wgFlaggedRevsAutoReview (works the same)
Modified paths:
  • /trunk/extensions/FlaggedRevs/FlaggedRevs.class.php (modified) (history)
  • /trunk/extensions/FlaggedRevs/FlaggedRevs.php (modified) (history)

Diff [purge]

Index: trunk/extensions/FlaggedRevs/FlaggedRevs.php
@@ -48,7 +48,7 @@
4949
5050 # Level constants...
5151 if ( !defined( 'FR_SIGHTED' ) )
52 - define( 'FR_SIGHTED', 0 );
 52+ define( 'FR_SIGHTED', 0 ); // "basic"/"checked"
5353 if ( !defined( 'FR_QUALITY' ) )
5454 define( 'FR_QUALITY', 1 );
5555 if ( !defined( 'FR_PRISTINE' ) )
@@ -82,8 +82,7 @@
8383
8484 # Allowed namespaces of reviewable pages
8585 $wgFlaggedRevsNamespaces = array( NS_MAIN, NS_FILE, NS_TEMPLATE );
86 -
87 -# Pages exempt from reviewing
 86+# Pages exempt from reviewing. No flagging UI will be shown for them.
8887 $wgFlaggedRevsWhitelist = array();
8988 # $wgFlaggedRevsWhitelist = array( 'Main_Page' );
9089
@@ -96,18 +95,18 @@
9796 # FR_QUALITY : "pristine" = "quality" > "sighted"
9897 # FR_SIGHTED : "pristine" = "quality" = "sighted"
9998 $wgFlaggedRevsPrecedence = FR_QUALITY;
100 -# Revision tagging can slow development...
101 -# For example, the main user base may become complacent, perhaps treat flagged
102 -# pages as "done", or just be too lazy to click "current". We may just want non-user
103 -# visitors to see reviewed pages by default.
10499 # Below are groups that see the current revision by default.
 100+# This makes editing easier since the users always start off
 101+# viewing the latest version of pages.
105102 $wgFlaggedRevsExceptions = array( 'user' );
106103
107104 # Can users make comments that will show up below flagged revisions?
108105 $wgFlaggedRevsComments = false;
109 -# Allow auto-review edits directly to the stable version by reviewers?
 106+# Auto-review edits that are:
 107+# (a) directly to the stable version by users with 'autoreview'/'bot'
 108+# (b) self-reversions back to the stable version by any user
110109 $wgFlaggedRevsAutoReview = true;
111 -# Auto-review new pages with the minimal level?
 110+# If $wgFlaggedRevsAutoReview, auto-review new pages as minimally "sighted"?
112111 $wgFlaggedRevsAutoReviewNew = true;
113112
114113 # Define the tags we can use to rate an article, number of levels,
@@ -119,13 +118,11 @@
120119 'depth' => array( 'levels' => 3, 'quality' => 1, 'pristine' => 4 ),
121120 'style' => array( 'levels' => 3, 'quality' => 1, 'pristine' => 4 ),
122121 );
123 -
124122 # For each tag, define the highest tag level that is unlocked by
125123 # having certain rights. For example, having 'review' rights may
126124 # allow for "depth" to be rated up to second level.
127 -# NOTE: Users cannot lower tags from a level they can't set.
128 -# NOTE: Users with 'validate' can do anything regardless.
129 -# This is mainly for custom, less experienced, groups
 125+# NOTE: Users cannot lower revision tags from a level they can't set.
 126+# NOTE: Users with 'validate' (Reviewers) can set all tags to all levels.
130127 $wgFlagRestrictions = array(
131128 'accuracy' => array( 'review' => 1, 'autoreview' => 1 ),
132129 'depth' => array( 'review' => 2, 'autoreview' => 2 ),
@@ -139,7 +136,7 @@
140137
141138 # Restriction levels for 'autoreview'/'review' rights.
142139 # When a level is selected for a page, an edit made by a user
143 -# requires approval unless that user has the specified permission.
 140+# will not be auto-reviewed if the user lacks the specified permission.
144141 # Levels are set at the Stabilization special page.
145142 $wgFlaggedRevsRestrictionLevels = array( '', 'sysop' );
146143 # Set this to use FlaggedRevs *only* as a protection-like mechanism.
@@ -150,33 +147,13 @@
151148 # NOTE: The stable version precedence cannot be configured per page with this.
152149 $wgFlaggedRevsProtection = false;
153150
154 -# URL location for flaggedrevs.css and flaggedrevs.js
155 -# Use a literal $wgScriptPath as a placeholder for the runtime value of $wgScriptPath
156 -$wgFlaggedRevsStylePath = '$wgScriptPath/extensions/FlaggedRevs/client';
157 -
158 -# Define our basic reviewer class
 151+# Define our basic reviewer class of established editors (Editors)
159152 $wgGroupPermissions['editor']['review'] = true;
160153 $wgGroupPermissions['editor']['autoreview'] = true;
161154 $wgGroupPermissions['editor']['autoconfirmed'] = true;
162155 $wgGroupPermissions['editor']['unreviewedpages'] = true;
163156 $wgGroupPermissions['editor']['patrolmarks'] = true;
164157
165 -# Defines extra rights for advanced reviewer class
166 -$wgGroupPermissions['reviewer']['validate'] = true;
167 -# Let this stand alone just in case...
168 -$wgGroupPermissions['reviewer']['review'] = true;
169 -$wgGroupPermissions['reviewer']['autoreview'] = true;
170 -$wgGroupPermissions['reviewer']['autoconfirmed'] = true;
171 -$wgGroupPermissions['reviewer']['unreviewedpages'] = true;
172 -$wgGroupPermissions['reviewer']['patrolmarks'] = true;
173 -
174 -# Sysops have their edits autoreviewed
175 -$wgGroupPermissions['sysop']['autoreview'] = true;
176 -# Stable version selection and default page revision selection can be set per page.
177 -$wgGroupPermissions['sysop']['stablesettings'] = true;
178 -# Sysops can always move stable pages
179 -$wgGroupPermissions['sysop']['movestable'] = true;
180 -
181158 # Define when users get automatically promoted to Editors. Set as false to disable.
182159 # 'spacing' and 'benchmarks' require edits to be spread out. Users must have X (benchmark)
183160 # edits Y (spacing) days apart.
@@ -219,6 +196,22 @@
220197 );
221198 */
222199
 200+# Defines extra rights for advanced reviewer class (Reviewers)
 201+$wgGroupPermissions['reviewer']['validate'] = true;
 202+# Let this stand alone just in case...
 203+$wgGroupPermissions['reviewer']['review'] = true;
 204+$wgGroupPermissions['reviewer']['autoreview'] = true;
 205+$wgGroupPermissions['reviewer']['autoconfirmed'] = true;
 206+$wgGroupPermissions['reviewer']['unreviewedpages'] = true;
 207+$wgGroupPermissions['reviewer']['patrolmarks'] = true;
 208+
 209+# Sysops have their edits autoreviewed
 210+$wgGroupPermissions['sysop']['autoreview'] = true;
 211+# Stable version selection and default page revision selection can be set per page.
 212+$wgGroupPermissions['sysop']['stablesettings'] = true;
 213+# Sysops can always move stable pages
 214+$wgGroupPermissions['sysop']['movestable'] = true;
 215+
223216 # Special:Userrights settings
224217 # # Basic rights for Sysops
225218 $wgAddGroups['sysop'][] = 'editor';
@@ -227,6 +220,10 @@
228221 $wgAddGroups['bureaucrat'][] = 'reviewer';
229222 $wgRemoveGroups['bureaucrat'][] = 'reviewer';
230223
 224+# URL location for flaggedrevs.css and flaggedrevs.js
 225+# Use a literal $wgScriptPath as a placeholder for the runtime value of $wgScriptPath
 226+$wgFlaggedRevsStylePath = '$wgScriptPath/extensions/FlaggedRevs/client';
 227+
231228 # Show reviews in recentchanges? Disabled by default, often spammy...
232229 $wgFlaggedRevsLogInRC = false;
233230 # Show automatic promotions to Editor in RC? Disabled by default, often spammy...
@@ -236,12 +233,13 @@
237234 $wgFlaggedRevsOversightAge = 30 * 24 * 3600;
238235
239236 # Flagged revisions are always visible to users with rights below.
240 -# Use '*' for non-user accounts.
 237+# Use '*' for non-user accounts. This is for read-restricted wikis.
241238 $wgFlaggedRevsVisible = array();
242239 # If $wgFlaggedRevsVisible is populated, it is applied to talk pages too
243240 $wgFlaggedRevsTalkVisible = true;
244241
245 -# How long before Special:ValidationStatistics is updated
 242+# How long before Special:ValidationStatistics is updated.
 243+# Set to false to disable (perhaps using a cron job instead).
246244 $wgFlaggedRevsStatsAge = 2 * 3600; // 2 hours
247245
248246 # How to handle templates and files used in stable versions:
Index: trunk/extensions/FlaggedRevs/FlaggedRevs.class.php
@@ -94,6 +94,11 @@
9595 self::$reviewNamespaces = $wgFlaggedRevsNamespaces;
9696 # Note: reviewable *pages* override patrollable ones
9797 self::$patrolNamespaces = $wgFlaggedRevsPatrolNamespaces;
 98+ # !$wgFlaggedRevsAutoReview => !$wgFlaggedRevsAutoReviewNew
 99+ global $wgFlaggedRevsAutoReview, $wgFlaggedRevsAutoReviewNew;
 100+ if ( !$wgFlaggedRevsAutoReview ) {
 101+ $wgFlaggedRevsAutoReviewNew = false;
 102+ }
98103 }
99104
100105 # ################ Basic config accessors #################
@@ -139,7 +144,6 @@
140145
141146 /**
142147 * Allow auto-review edits directly to the stable version by reviewers?
143 - * (1 to allow auto-sighting; 2 for auto-quality; 3 for auto-pristine)
144148 * @returns bool
145149 */
146150 public static function autoReviewEdits() {
@@ -148,6 +152,16 @@
149153 }
150154
151155 /**
 156+ * Auto-review new pages with the minimal level?
 157+ * @returns bool
 158+ */
 159+ public static function autoReviewNewPages() {
 160+ global $wgFlaggedRevsAutoReviewNew;
 161+ self::load();
 162+ return (bool)$wgFlaggedRevsAutoReviewNew;
 163+ }
 164+
 165+ /**
152166 * Get the maximum level that $tag can be autoreviewed to
153167 * @param string $tag
154168 * @returns int
@@ -166,15 +180,6 @@
167181 }
168182
169183 /**
170 - * Auto-review new pages with the minimal level?
171 - * @returns bool
172 - */
173 - public static function autoReviewNewPages() {
174 - global $wgFlaggedRevsAutoReviewNew;
175 - return (bool)$wgFlaggedRevsAutoReviewNew;
176 - }
177 -
178 - /**
179184 * Is a "stable version" used as the default display
180185 * version for all pages in reviewable namespaces?
181186 * @returns bool

Status & tagging log