Index: trunk/extensions/FlaggedRevs/FlaggedRevs.php |
— | — | @@ -70,7 +70,7 @@ |
71 | 71 | 'descriptionmsg' => 'flaggedrevs-desc', |
72 | 72 | ); |
73 | 73 | |
74 | | -# ######## |
| 74 | +# ######## Configuration variables ######## |
75 | 75 | # IMPORTANT: DO NOT EDIT THIS FILE |
76 | 76 | # When configuring globals, set them at LocalSettings.php instead |
77 | 77 | |
— | — | @@ -189,10 +189,12 @@ |
190 | 190 | |
191 | 191 | # Implicit autoreview group |
192 | 192 | $wgGroupPermissions['autoreview']['autoreview'] = true; |
| 193 | +# Don't show the 'autoreview' group everywhere |
| 194 | +$wgImplicitGroups[] = 'autoreview'; |
193 | 195 | |
194 | 196 | # Define when users get automatically promoted to Editors. Set as false to disable. |
195 | 197 | # '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. |
197 | 199 | $wgFlaggedRevsAutopromote = array( |
198 | 200 | 'days' => 60, # days since registration |
199 | 201 | 'edits' => 250, # total edit count |
— | — | @@ -214,6 +216,8 @@ |
215 | 217 | |
216 | 218 | # Define when users get to have their own edits auto-reviewed. |
217 | 219 | # 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. |
218 | 222 | $wgFlaggedRevsAutoconfirm = false; |
219 | 223 | /* (example usage) |
220 | 224 | $wgFlaggedRevsAutoconfirm = array( |
— | — | @@ -236,7 +240,6 @@ |
237 | 241 | $wgAddGroups['sysop'][] = 'editor'; |
238 | 242 | $wgRemoveGroups['sysop'][] = 'editor'; |
239 | 243 | # # Extra ones for Bureaucrats |
240 | | -# # Add UI page rights just in case we have non-sysop bcrats |
241 | 244 | $wgAddGroups['bureaucrat'][] = 'reviewer'; |
242 | 245 | $wgRemoveGroups['bureaucrat'][] = 'reviewer'; |
243 | 246 | |
— | — | @@ -408,6 +411,12 @@ |
409 | 412 | $wgAutoloadClasses['ApiStabilize'] = $dir . 'api/ApiStabilize.php'; |
410 | 413 | $wgAPIModules['stabilize'] = 'ApiStabilize'; |
411 | 414 | |
| 415 | +# New user preferences |
| 416 | +$wgDefaultUserOptions['flaggedrevssimpleui'] = (int)$wgSimpleFlaggedRevsUI; |
| 417 | +$wgDefaultUserOptions['flaggedrevsstable'] = false; |
| 418 | +$wgDefaultUserOptions['flaggedrevseditdiffs'] = true; |
| 419 | +$wgDefaultUserOptions['flaggedrevsviewdiffs'] = false; |
| 420 | + |
412 | 421 | # ####### HOOK TRIGGERED FUNCTIONS ######### |
413 | 422 | |
414 | 423 | # ######## User interface ######### |
— | — | @@ -563,18 +572,17 @@ |
564 | 573 | # Edits to reviewable pages must be flagged to be patrolled. |
565 | 574 | $wgUseRCPatrol = true; |
566 | 575 | } |
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(); |
573 | 578 | # Load hooks that aren't always set |
574 | 579 | 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() { |
579 | 587 | global $wgAPIListModules; |
580 | 588 | if ( !FlaggedRevs::stableOnlyIfConfigured() ) { |
581 | 589 | $wgAPIListModules['reviewedpages'] = 'ApiQueryReviewedpages'; |
— | — | @@ -582,6 +590,24 @@ |
583 | 591 | } |
584 | 592 | } |
585 | 593 | |
| 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 | + |
586 | 612 | # Add review log |
587 | 613 | $wgLogTypes[] = 'review'; |
588 | 614 | $wgFilterLogTypes['review'] = true; |
Index: trunk/extensions/FlaggedRevs/language/FlaggedRevs.i18n.php |
— | — | @@ -251,7 +251,7 @@ |
252 | 252 | 'revreview-reviewlink-title' => 'View diff of all pending changes', |
253 | 253 | 'revreview-unreviewedpage' => 'unchecked page', |
254 | 254 | |
255 | | - 'tooltip-ca-current' => 'View this page with pending changes', |
| 255 | + 'tooltip-ca-current' => 'View this page with the pending changes', |
256 | 256 | 'tooltip-ca-stable' => 'View the accepted version of this page', |
257 | 257 | 'tooltip-ca-default' => 'Quality assurance settings', |
258 | 258 | |
Index: trunk/extensions/FlaggedRevs/FlaggedRevs.hooks.php |
— | — | @@ -1217,9 +1217,12 @@ |
1218 | 1218 | } |
1219 | 1219 | |
1220 | 1220 | /** |
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. |
1224 | 1227 | */ |
1225 | 1228 | public static function checkAutoPromote( $user, &$promote ) { |
1226 | 1229 | global $wgFlaggedRevsAutoconfirm, $wgMemc; |