r52966 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r52965‎ | r52966 | r52967 >
Date:04:23, 9 July 2009
Author:aaron
Status:ok
Tags:
Comment:
* Fixed silly variable collision from r52964
* Disable $wgFlaggedRevsAutoconfirm by default
Modified paths:
  • /trunk/extensions/FlaggedRevs/FlaggedRevs.hooks.php (modified) (history)
  • /trunk/extensions/FlaggedRevs/FlaggedRevs.php (modified) (history)

Diff [purge]

Index: trunk/extensions/FlaggedRevs/FlaggedRevs.php
@@ -213,7 +213,9 @@
214214
215215 # Define when users get to have their own edits auto-reviewed
216216 # This can be used for newer, semi-trusted users to improve workflow.
217 -$wgFlaggedRevsAutoreview = array(
 217+$wgFlaggedRevsAutoconfirm = false;
 218+/* (example usage)
 219+$wgFlaggedRevsAutoconfirm = array(
218220 'days' => 30, # days since registration
219221 'edits' => 50, # total edit count
220222 'spacing' => 3, # spacing of edit intervals
@@ -222,11 +224,12 @@
223225 'totalContentEdits' => 150, # $wgContentNamespaces edits OR...
224226 'totalCheckedEdits' => 50, # ...Edits before the stable version of pages
225227 'uniqueContentPages' => 8, # $wgContentNamespaces unique pages edited
226 - 'editComments' => 30, # how many edit comments used?
 228+ 'editComments' => 20, # how many edit comments used?
227229 'email' => false, # user must be emailconfirmed?
228230 'neverBlocked' => true, # Can users that were blocked be promoted?
229231 'maxRevertedEdits' => 5, # Max edits the user could have had rolled back?
230232 );
 233+*/
231234
232235 # Special:Userrights settings
233236 ## Basic rights for Sysops
Index: trunk/extensions/FlaggedRevs/FlaggedRevs.hooks.php
@@ -986,16 +986,16 @@
987987 * accounts are also handled here to make sure that can autoreview.
988988 */
989989 public static function checkAutoPromote( $user, &$promote ) {
990 - global $wgFlaggedRevsAutoreview, $wgMemc;
 990+ global $wgFlaggedRevsAutoconfirm, $wgMemc;
991991 # Make sure bots always have autoreview
992992 if( $user->isAllowed('bot') ) {
993993 $promote[] = 'autoreview';
994994 return true;
995995 }
996 - # Check if $wgFlaggedRevsAutoreview is actually enabled
 996+ # Check if $wgFlaggedRevsAutoconfirm is actually enabled
997997 # and that this is a logged-in user that doesn't already
998998 # have the 'autoreview' permission
999 - if( !$user->getId() || $user->isAllowed('autoreview') || empty($wgFlaggedRevsAutoreview) ) {
 999+ if( !$user->getId() || $user->isAllowed('autoreview') || empty($wgFlaggedRevsAutoconfirm) ) {
10001000 return true;
10011001 }
10021002 # Check if results are cached to avoid DB queries.
@@ -1003,7 +1003,7 @@
10041004 $APSkipKey = wfMemcKey( 'flaggedrevs', 'autoreview-skip', $user->getId() );
10051005 $value = $wgMemc->get( $APSkipKey );
10061006 if( $value == 'true' ) return true;
1007 - # Check $wgFlaggedRevsAutoreview settings...
 1007+ # Check $wgFlaggedRevsAutoconfirm settings...
10081008 $now = time();
10091009 $userCreation = wfTimestampOrNull( TS_UNIX, $user->getRegistration() );
10101010 # User registration was not always tracked in DB...use null for such cases
@@ -1011,35 +1011,35 @@
10121012 $p = FlaggedRevs::getUserParams( $user->getId() );
10131013 # Check if user edited enough content pages
10141014 $totalCheckedEditsNeeded = false;
1015 - if( $wgFlaggedRevsAutoreview['totalContentEdits'] > $p['totalContentEdits'] ) {
1016 - if( !$wgFlaggedRevsAutoreview['totalCheckedEdits'] ) {
 1015+ if( $wgFlaggedRevsAutoconfirm['totalContentEdits'] > $p['totalContentEdits'] ) {
 1016+ if( !$wgFlaggedRevsAutoconfirm['totalCheckedEdits'] ) {
10171017 return true;
10181018 }
10191019 $totalCheckedEditsNeeded = true;
10201020 }
10211021 # Check if user edited enough unique pages
10221022 $pages = explode( ',', trim($p['uniqueContentPages']) ); // page IDs
1023 - if( $wgFlaggedRevsAutoreview['uniqueContentPages'] > count($pages) ) {
 1023+ if( $wgFlaggedRevsAutoconfirm['uniqueContentPages'] > count($pages) ) {
10241024 return true;
10251025 }
10261026 # Check edit comment use
1027 - if( $wgFlaggedRevsAutoreview['editComments'] > $p['editComments'] ) {
 1027+ if( $wgFlaggedRevsAutoconfirm['editComments'] > $p['editComments'] ) {
10281028 return true;
10291029 }
10301030 # Check reverted edits
1031 - if( $wgFlaggedRevsAutoreview['maxRevertedEdits'] < $p['revertedEdits'] ) {
 1031+ if( $wgFlaggedRevsAutoconfirm['maxRevertedEdits'] < $p['revertedEdits'] ) {
10321032 return true;
10331033 }
10341034 # Check account age
1035 - if( !is_null($userage) && $userage < $wgFlaggedRevsAutoreview['days'] ) {
 1035+ if( !is_null($userage) && $userage < $wgFlaggedRevsAutoconfirm['days'] ) {
10361036 return true;
10371037 }
10381038 # Check user edit count. Should be stored.
1039 - if( $user->getEditCount() < $wgFlaggedRevsAutoreview['edits'] ) {
 1039+ if( $user->getEditCount() < $wgFlaggedRevsAutoconfirm['edits'] ) {
10401040 return true;
10411041 }
10421042 # Check user email
1043 - if( $wgFlaggedRevsAutoreview['email'] && !$user->isEmailConfirmed() ) {
 1043+ if( $wgFlaggedRevsAutoconfirm['email'] && !$user->isEmailConfirmed() ) {
10441044 return true;
10451045 }
10461046 # Don't grant to currently blocked users...
@@ -1047,7 +1047,7 @@
10481048 return true;
10491049 }
10501050 # Check if user was ever blocked before
1051 - if( $wgFlaggedRevsAutoreview['neverBlocked'] ) {
 1051+ if( $wgFlaggedRevsAutoconfirm['neverBlocked'] ) {
10521052 $dbr = wfGetDB( DB_SLAVE );
10531053 $blocked = $dbr->selectField( 'logging', '1',
10541054 array( 'log_namespace' => NS_USER,
@@ -1064,15 +1064,15 @@
10651065 }
10661066 # Check for edit spacing. This lets us know that the account has
10671067 # 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 ) {
10691069 $sTestKey = wfMemcKey( 'flaggedrevs', 'autoreview-spacing-ok', $user->getId() );
10701070 $value = $wgMemc->get( $sTestKey );
10711071 # Check if the user already passed this test via cache.
10721072 # If no cache key is available, then check the DB...
10731073 if( $value !== 'true' ) {
10741074 $pass = self::editSpacingCheck(
1075 - $wgFlaggedRevsAutoreview['spacing'],
1076 - $wgFlaggedRevsAutoreview['benchmarks'],
 1075+ $wgFlaggedRevsAutoconfirm['spacing'],
 1076+ $wgFlaggedRevsAutoconfirm['benchmarks'],
10771077 $user
10781078 );
10791079 # Make a key to store the results
@@ -1094,11 +1094,11 @@
10951095 * $wgFlaggedRevsAutopromote. This also handles user stats tallies.
10961096 */
10971097 public static function maybeMakeEditor( $article, $user, $text, $summary, $m, $a, $b, &$f, $rev ) {
1098 - global $wgFlaggedRevsAutopromote, $wgFlaggedRevsAutoreview, $wgMemc;
 1098+ global $wgFlaggedRevsAutopromote, $wgFlaggedRevsAutoconfirm, $wgMemc;
10991099 # Ignore NULL edits or edits by anon users
11001100 if( !$rev || !$user->getId() ) return true;
11011101 # No sense in running counters if nothing uses them
1102 - if( empty($wgFlaggedRevsAutopromote) && empty($wgFlaggedRevsAutoreview) ) {
 1102+ if( empty($wgFlaggedRevsAutopromote) && empty($wgFlaggedRevsAutoconfirm) ) {
11031103 return true;
11041104 }
11051105 $p = FlaggedRevs::getUserParams( $user->getId() );
@@ -1108,7 +1108,7 @@
11091109 if( $article->getTitle()->isContentPage() ) {
11101110 $pages = explode( ',', trim($p['uniqueContentPages']) ); // page IDs
11111111 # Don't let this get bloated for no reason
1112 - # (assumes $wgFlaggedRevsAutopromote is stricter than $wgFlaggedRevsAutoreview)
 1112+ # (assumes $wgFlaggedRevsAutopromote is stricter than $wgFlaggedRevsAutoconfirm)
11131113 if( count($pages) < $wgFlaggedRevsAutopromote['uniqueContentPages']
11141114 && !in_array($article->getId(),$pages) )
11151115 {
@@ -1216,8 +1216,8 @@
12171217 # If no cache key is available, then check the DB...
12181218 if( $value !== 'true' ) {
12191219 $pass = self::editSpacingCheck(
1220 - $wgFlaggedRevsAutoreview['spacing'],
1221 - $wgFlaggedRevsAutoreview['benchmarks'],
 1220+ $wgFlaggedRevsAutopromote['spacing'],
 1221+ $wgFlaggedRevsAutopromote['benchmarks'],
12221222 $user
12231223 );
12241224 # Make a key to store the results

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r52964* Replaced hard-coded checks with $wgFlaggedRevsAutoreview to implement .de w...aaron03:57, 9 July 2009

Status & tagging log