r67390 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r67389‎ | r67390 | r67391 >
Date:05:37, 5 June 2010
Author:aaron
Status:ok
Tags:
Comment:
* Remove 'unreviewedpages' right when it is not applicable
* Split efLoadFlaggedRevs() into more functions
* Improved doc comments
Modified paths:
  • /trunk/extensions/FlaggedRevs/FlaggedRevs.hooks.php (modified) (history)
  • /trunk/extensions/FlaggedRevs/FlaggedRevs.php (modified) (history)
  • /trunk/extensions/FlaggedRevs/language/FlaggedRevs.i18n.php (modified) (history)

Diff [purge]

Index: trunk/extensions/FlaggedRevs/FlaggedRevs.php
@@ -70,7 +70,7 @@
7171 'descriptionmsg' => 'flaggedrevs-desc',
7272 );
7373
74 -# ########
 74+# ######## Configuration variables ########
7575 # IMPORTANT: DO NOT EDIT THIS FILE
7676 # When configuring globals, set them at LocalSettings.php instead
7777
@@ -189,10 +189,12 @@
190190
191191 # Implicit autoreview group
192192 $wgGroupPermissions['autoreview']['autoreview'] = true;
 193+# Don't show the 'autoreview' group everywhere
 194+$wgImplicitGroups[] = 'autoreview';
193195
194196 # Define when users get automatically promoted to Editors. Set as false to disable.
195197 # 'spacing' and 'benchmarks' require edits to be spread out. Users must have X (benchmark)
196 -# edits Y (spacing) days apart.
 198+# edits Y (spacing) days apart. Set to false to disable.
197199 $wgFlaggedRevsAutopromote = array(
198200 'days' => 60, # days since registration
199201 'edits' => 250, # total edit count
@@ -214,6 +216,8 @@
215217
216218 # Define when users get to have their own edits auto-reviewed.
217219 # This can be used for newer, semi-trusted users to improve workflow.
 220+# It is done by granting some users the implicit 'autoreview' group.
 221+# Set to false to disable.
218222 $wgFlaggedRevsAutoconfirm = false;
219223 /* (example usage)
220224 $wgFlaggedRevsAutoconfirm = array(
@@ -236,7 +240,6 @@
237241 $wgAddGroups['sysop'][] = 'editor';
238242 $wgRemoveGroups['sysop'][] = 'editor';
239243 # # Extra ones for Bureaucrats
240 -# # Add UI page rights just in case we have non-sysop bcrats
241244 $wgAddGroups['bureaucrat'][] = 'reviewer';
242245 $wgRemoveGroups['bureaucrat'][] = 'reviewer';
243246
@@ -408,6 +411,12 @@
409412 $wgAutoloadClasses['ApiStabilize'] = $dir . 'api/ApiStabilize.php';
410413 $wgAPIModules['stabilize'] = 'ApiStabilize';
411414
 415+# New user preferences
 416+$wgDefaultUserOptions['flaggedrevssimpleui'] = (int)$wgSimpleFlaggedRevsUI;
 417+$wgDefaultUserOptions['flaggedrevsstable'] = false;
 418+$wgDefaultUserOptions['flaggedrevseditdiffs'] = true;
 419+$wgDefaultUserOptions['flaggedrevsviewdiffs'] = false;
 420+
412421 # ####### HOOK TRIGGERED FUNCTIONS #########
413422
414423 # ######## User interface #########
@@ -563,18 +572,17 @@
564573 # Edits to reviewable pages must be flagged to be patrolled.
565574 $wgUseRCPatrol = true;
566575 }
567 - # Defaults for user preferences
568 - global $wgDefaultUserOptions, $wgSimpleFlaggedRevsUI;
569 - $wgDefaultUserOptions['flaggedrevssimpleui'] = (int)$wgSimpleFlaggedRevsUI;
570 - $wgDefaultUserOptions['flaggedrevsstable'] = false;
571 - $wgDefaultUserOptions['flaggedrevseditdiffs'] = true;
572 - $wgDefaultUserOptions['flaggedrevsviewdiffs'] = false;
 576+ # Conditional API modules
 577+ efSetFlaggedRevsConditionalAPIModules();
573578 # Load hooks that aren't always set
574579 efSetFlaggedRevsConditionalHooks();
575 - # Don't show autoreview group everywhere
576 - global $wgImplicitGroups;
577 - $wgImplicitGroups[] = 'autoreview';
578 - # Conditional API modules
 580+ # Remove conditionally applicable rights
 581+ efSetFlaggedRevsConditionalRights();
 582+ # Defaults for user preferences
 583+ efSetFlaggedRevsConditionalPreferences();
 584+}
 585+
 586+function efSetFlaggedRevsConditionalAPIModules() {
579587 global $wgAPIListModules;
580588 if ( !FlaggedRevs::stableOnlyIfConfigured() ) {
581589 $wgAPIListModules['reviewedpages'] = 'ApiQueryReviewedpages';
@@ -582,6 +590,24 @@
583591 }
584592 }
585593
 594+function efSetFlaggedRevsConditionalRights() {
 595+ global $wgGroupPermissions;
 596+ if ( FlaggedRevs::stableOnlyIfConfigured() ) {
 597+ // Removes sp:ListGroupRights cruft
 598+ if ( isset( $wgGroupPermissions['editor'] ) ) {
 599+ unset( $wgGroupPermissions['editor']['unreviewedpages'] );
 600+ }
 601+ if ( isset( $wgGroupPermissions['reviewer'] ) ) {
 602+ unset( $wgGroupPermissions['reviewer']['unreviewedpages'] );
 603+ }
 604+ }
 605+}
 606+
 607+function efSetFlaggedRevsConditionalPreferences() {
 608+ global $wgDefaultUserOptions, $wgSimpleFlaggedRevsUI;
 609+ $wgDefaultUserOptions['flaggedrevssimpleui'] = (int)$wgSimpleFlaggedRevsUI;
 610+}
 611+
586612 # Add review log
587613 $wgLogTypes[] = 'review';
588614 $wgFilterLogTypes['review'] = true;
Index: trunk/extensions/FlaggedRevs/language/FlaggedRevs.i18n.php
@@ -251,7 +251,7 @@
252252 'revreview-reviewlink-title' => 'View diff of all pending changes',
253253 'revreview-unreviewedpage' => 'unchecked page',
254254
255 - 'tooltip-ca-current' => 'View this page with pending changes',
 255+ 'tooltip-ca-current' => 'View this page with the pending changes',
256256 'tooltip-ca-stable' => 'View the accepted version of this page',
257257 'tooltip-ca-default' => 'Quality assurance settings',
258258
Index: trunk/extensions/FlaggedRevs/FlaggedRevs.hooks.php
@@ -1217,9 +1217,12 @@
12181218 }
12191219
12201220 /**
1221 - * Check for 'autoreview' permission. This lets people who opt-out as
1222 - * Editors still have their own edits automatically reviewed. Bot
1223 - * accounts are also handled here to make sure that can autoreview.
 1221+ * (a) Grant implicit 'autoreview' group for users meeting $wgFlaggedRevsAutoconfirm
 1222+ * requirements that don't already have the 'autoreview' right. This lets people
 1223+ * who opt-out as Editors still have their own edits automatically reviewed.
 1224+ * (b) Grant implicit 'autoreview' group for user with the 'bot' right that don't
 1225+ * already have the 'autoreview' right.
 1226+ * Note: some unobtrusive caching is used to avoid DB hits.
12241227 */
12251228 public static function checkAutoPromote( $user, &$promote ) {
12261229 global $wgFlaggedRevsAutoconfirm, $wgMemc;

Status & tagging log