Index: trunk/extensions/FlaggedRevs/FlaggedRevs.php |
— | — | @@ -213,7 +213,9 @@ |
214 | 214 | |
215 | 215 | # Define when users get to have their own edits auto-reviewed |
216 | 216 | # This can be used for newer, semi-trusted users to improve workflow. |
217 | | -$wgFlaggedRevsAutoreview = array( |
| 217 | +$wgFlaggedRevsAutoconfirm = false; |
| 218 | +/* (example usage) |
| 219 | +$wgFlaggedRevsAutoconfirm = array( |
218 | 220 | 'days' => 30, # days since registration |
219 | 221 | 'edits' => 50, # total edit count |
220 | 222 | 'spacing' => 3, # spacing of edit intervals |
— | — | @@ -222,11 +224,12 @@ |
223 | 225 | 'totalContentEdits' => 150, # $wgContentNamespaces edits OR... |
224 | 226 | 'totalCheckedEdits' => 50, # ...Edits before the stable version of pages |
225 | 227 | 'uniqueContentPages' => 8, # $wgContentNamespaces unique pages edited |
226 | | - 'editComments' => 30, # how many edit comments used? |
| 228 | + 'editComments' => 20, # how many edit comments used? |
227 | 229 | 'email' => false, # user must be emailconfirmed? |
228 | 230 | 'neverBlocked' => true, # Can users that were blocked be promoted? |
229 | 231 | 'maxRevertedEdits' => 5, # Max edits the user could have had rolled back? |
230 | 232 | ); |
| 233 | +*/ |
231 | 234 | |
232 | 235 | # Special:Userrights settings |
233 | 236 | ## Basic rights for Sysops |
Index: trunk/extensions/FlaggedRevs/FlaggedRevs.hooks.php |
— | — | @@ -986,16 +986,16 @@ |
987 | 987 | * accounts are also handled here to make sure that can autoreview. |
988 | 988 | */ |
989 | 989 | public static function checkAutoPromote( $user, &$promote ) { |
990 | | - global $wgFlaggedRevsAutoreview, $wgMemc; |
| 990 | + global $wgFlaggedRevsAutoconfirm, $wgMemc; |
991 | 991 | # Make sure bots always have autoreview |
992 | 992 | if( $user->isAllowed('bot') ) { |
993 | 993 | $promote[] = 'autoreview'; |
994 | 994 | return true; |
995 | 995 | } |
996 | | - # Check if $wgFlaggedRevsAutoreview is actually enabled |
| 996 | + # Check if $wgFlaggedRevsAutoconfirm is actually enabled |
997 | 997 | # and that this is a logged-in user that doesn't already |
998 | 998 | # have the 'autoreview' permission |
999 | | - if( !$user->getId() || $user->isAllowed('autoreview') || empty($wgFlaggedRevsAutoreview) ) { |
| 999 | + if( !$user->getId() || $user->isAllowed('autoreview') || empty($wgFlaggedRevsAutoconfirm) ) { |
1000 | 1000 | return true; |
1001 | 1001 | } |
1002 | 1002 | # Check if results are cached to avoid DB queries. |
— | — | @@ -1003,7 +1003,7 @@ |
1004 | 1004 | $APSkipKey = wfMemcKey( 'flaggedrevs', 'autoreview-skip', $user->getId() ); |
1005 | 1005 | $value = $wgMemc->get( $APSkipKey ); |
1006 | 1006 | if( $value == 'true' ) return true; |
1007 | | - # Check $wgFlaggedRevsAutoreview settings... |
| 1007 | + # Check $wgFlaggedRevsAutoconfirm settings... |
1008 | 1008 | $now = time(); |
1009 | 1009 | $userCreation = wfTimestampOrNull( TS_UNIX, $user->getRegistration() ); |
1010 | 1010 | # User registration was not always tracked in DB...use null for such cases |
— | — | @@ -1011,35 +1011,35 @@ |
1012 | 1012 | $p = FlaggedRevs::getUserParams( $user->getId() ); |
1013 | 1013 | # Check if user edited enough content pages |
1014 | 1014 | $totalCheckedEditsNeeded = false; |
1015 | | - if( $wgFlaggedRevsAutoreview['totalContentEdits'] > $p['totalContentEdits'] ) { |
1016 | | - if( !$wgFlaggedRevsAutoreview['totalCheckedEdits'] ) { |
| 1015 | + if( $wgFlaggedRevsAutoconfirm['totalContentEdits'] > $p['totalContentEdits'] ) { |
| 1016 | + if( !$wgFlaggedRevsAutoconfirm['totalCheckedEdits'] ) { |
1017 | 1017 | return true; |
1018 | 1018 | } |
1019 | 1019 | $totalCheckedEditsNeeded = true; |
1020 | 1020 | } |
1021 | 1021 | # Check if user edited enough unique pages |
1022 | 1022 | $pages = explode( ',', trim($p['uniqueContentPages']) ); // page IDs |
1023 | | - if( $wgFlaggedRevsAutoreview['uniqueContentPages'] > count($pages) ) { |
| 1023 | + if( $wgFlaggedRevsAutoconfirm['uniqueContentPages'] > count($pages) ) { |
1024 | 1024 | return true; |
1025 | 1025 | } |
1026 | 1026 | # Check edit comment use |
1027 | | - if( $wgFlaggedRevsAutoreview['editComments'] > $p['editComments'] ) { |
| 1027 | + if( $wgFlaggedRevsAutoconfirm['editComments'] > $p['editComments'] ) { |
1028 | 1028 | return true; |
1029 | 1029 | } |
1030 | 1030 | # Check reverted edits |
1031 | | - if( $wgFlaggedRevsAutoreview['maxRevertedEdits'] < $p['revertedEdits'] ) { |
| 1031 | + if( $wgFlaggedRevsAutoconfirm['maxRevertedEdits'] < $p['revertedEdits'] ) { |
1032 | 1032 | return true; |
1033 | 1033 | } |
1034 | 1034 | # Check account age |
1035 | | - if( !is_null($userage) && $userage < $wgFlaggedRevsAutoreview['days'] ) { |
| 1035 | + if( !is_null($userage) && $userage < $wgFlaggedRevsAutoconfirm['days'] ) { |
1036 | 1036 | return true; |
1037 | 1037 | } |
1038 | 1038 | # Check user edit count. Should be stored. |
1039 | | - if( $user->getEditCount() < $wgFlaggedRevsAutoreview['edits'] ) { |
| 1039 | + if( $user->getEditCount() < $wgFlaggedRevsAutoconfirm['edits'] ) { |
1040 | 1040 | return true; |
1041 | 1041 | } |
1042 | 1042 | # Check user email |
1043 | | - if( $wgFlaggedRevsAutoreview['email'] && !$user->isEmailConfirmed() ) { |
| 1043 | + if( $wgFlaggedRevsAutoconfirm['email'] && !$user->isEmailConfirmed() ) { |
1044 | 1044 | return true; |
1045 | 1045 | } |
1046 | 1046 | # Don't grant to currently blocked users... |
— | — | @@ -1047,7 +1047,7 @@ |
1048 | 1048 | return true; |
1049 | 1049 | } |
1050 | 1050 | # Check if user was ever blocked before |
1051 | | - if( $wgFlaggedRevsAutoreview['neverBlocked'] ) { |
| 1051 | + if( $wgFlaggedRevsAutoconfirm['neverBlocked'] ) { |
1052 | 1052 | $dbr = wfGetDB( DB_SLAVE ); |
1053 | 1053 | $blocked = $dbr->selectField( 'logging', '1', |
1054 | 1054 | array( 'log_namespace' => NS_USER, |
— | — | @@ -1064,15 +1064,15 @@ |
1065 | 1065 | } |
1066 | 1066 | # Check for edit spacing. This lets us know that the account has |
1067 | 1067 | # been used over N different days, rather than all in one lump. |
1068 | | - if( $wgFlaggedRevsAutoreview['spacing'] > 0 && $wgFlaggedRevsAutoreview['benchmarks'] > 1 ) { |
| 1068 | + if( $wgFlaggedRevsAutoconfirm['spacing'] > 0 && $wgFlaggedRevsAutoconfirm['benchmarks'] > 1 ) { |
1069 | 1069 | $sTestKey = wfMemcKey( 'flaggedrevs', 'autoreview-spacing-ok', $user->getId() ); |
1070 | 1070 | $value = $wgMemc->get( $sTestKey ); |
1071 | 1071 | # Check if the user already passed this test via cache. |
1072 | 1072 | # If no cache key is available, then check the DB... |
1073 | 1073 | if( $value !== 'true' ) { |
1074 | 1074 | $pass = self::editSpacingCheck( |
1075 | | - $wgFlaggedRevsAutoreview['spacing'], |
1076 | | - $wgFlaggedRevsAutoreview['benchmarks'], |
| 1075 | + $wgFlaggedRevsAutoconfirm['spacing'], |
| 1076 | + $wgFlaggedRevsAutoconfirm['benchmarks'], |
1077 | 1077 | $user |
1078 | 1078 | ); |
1079 | 1079 | # Make a key to store the results |
— | — | @@ -1094,11 +1094,11 @@ |
1095 | 1095 | * $wgFlaggedRevsAutopromote. This also handles user stats tallies. |
1096 | 1096 | */ |
1097 | 1097 | public static function maybeMakeEditor( $article, $user, $text, $summary, $m, $a, $b, &$f, $rev ) { |
1098 | | - global $wgFlaggedRevsAutopromote, $wgFlaggedRevsAutoreview, $wgMemc; |
| 1098 | + global $wgFlaggedRevsAutopromote, $wgFlaggedRevsAutoconfirm, $wgMemc; |
1099 | 1099 | # Ignore NULL edits or edits by anon users |
1100 | 1100 | if( !$rev || !$user->getId() ) return true; |
1101 | 1101 | # No sense in running counters if nothing uses them |
1102 | | - if( empty($wgFlaggedRevsAutopromote) && empty($wgFlaggedRevsAutoreview) ) { |
| 1102 | + if( empty($wgFlaggedRevsAutopromote) && empty($wgFlaggedRevsAutoconfirm) ) { |
1103 | 1103 | return true; |
1104 | 1104 | } |
1105 | 1105 | $p = FlaggedRevs::getUserParams( $user->getId() ); |
— | — | @@ -1108,7 +1108,7 @@ |
1109 | 1109 | if( $article->getTitle()->isContentPage() ) { |
1110 | 1110 | $pages = explode( ',', trim($p['uniqueContentPages']) ); // page IDs |
1111 | 1111 | # Don't let this get bloated for no reason |
1112 | | - # (assumes $wgFlaggedRevsAutopromote is stricter than $wgFlaggedRevsAutoreview) |
| 1112 | + # (assumes $wgFlaggedRevsAutopromote is stricter than $wgFlaggedRevsAutoconfirm) |
1113 | 1113 | if( count($pages) < $wgFlaggedRevsAutopromote['uniqueContentPages'] |
1114 | 1114 | && !in_array($article->getId(),$pages) ) |
1115 | 1115 | { |
— | — | @@ -1216,8 +1216,8 @@ |
1217 | 1217 | # If no cache key is available, then check the DB... |
1218 | 1218 | if( $value !== 'true' ) { |
1219 | 1219 | $pass = self::editSpacingCheck( |
1220 | | - $wgFlaggedRevsAutoreview['spacing'], |
1221 | | - $wgFlaggedRevsAutoreview['benchmarks'], |
| 1220 | + $wgFlaggedRevsAutopromote['spacing'], |
| 1221 | + $wgFlaggedRevsAutopromote['benchmarks'], |
1222 | 1222 | $user |
1223 | 1223 | ); |
1224 | 1224 | # Make a key to store the results |