Index: trunk/extensions/FlaggedRevs/FlaggedRevs.php |
— | — | @@ -208,6 +208,7 @@ |
209 | 209 | 'userpageBytes' => 100, # if userpage is needed, what is the min size? |
210 | 210 | 'uniqueIPAddress' => false, # If $wgPutIPinRC is true, users sharing IPs won't be promoted |
211 | 211 | 'neverBlocked' => true, # Can users that were blocked be promoted? |
| 212 | + 'maxRevertedEdits' => 5, # Max edits the user could have had rolled back? (not used yet) |
212 | 213 | 'noSorbsMatches' => false, # If $wgSorbsUrl is set, do not promote users that match |
213 | 214 | ); |
214 | 215 | |
— | — | @@ -417,6 +418,8 @@ |
418 | 419 | # Autoreview stuff |
419 | 420 | $wgHooks['EditPage::showEditForm:fields'][] = 'FlaggedRevsHooks::addRevisionIDField'; |
420 | 421 | $wgHooks['EditPageBeforeEditChecks'][] = 'FlaggedRevsHooks::addReviewCheck'; |
| 422 | +# User stats |
| 423 | +$wgHooks['ArticleRollbackComplete'][] = 'FlaggedRevsHooks::incrementRollbacks'; |
421 | 424 | |
422 | 425 | # Add CSS/JS as needed |
423 | 426 | $wgHooks['OutputPageParserOutput'][] = 'FlaggedRevsHooks::injectStyleAndJS'; |
Index: trunk/extensions/FlaggedRevs/FlaggedRevs.hooks.php |
— | — | @@ -775,6 +775,18 @@ |
776 | 776 | } |
777 | 777 | return true; |
778 | 778 | } |
| 779 | + |
| 780 | + public static function incrementRollbacks( $this, $user, $target, $current ) { |
| 781 | + if( $current->getRawUser() ) { |
| 782 | + global $wgFlaggedRevsAutopromote; |
| 783 | + $p = FlaggedRevs::getUserParams( $current->getRawUser() ); |
| 784 | + $p['revertedEdits'] = isset($p['revertedEdits']) ? $p['revertedEdits'] : 0; |
| 785 | + $p['revertedEdits']++; |
| 786 | + if( $wgFlaggedRevsAutopromote['maxRevertedEdits'] >= $p['revertedEdits'] ) |
| 787 | + FlaggedRevs::saveUserParams( $current->getRawUser(), $p ); |
| 788 | + } |
| 789 | + return true; |
| 790 | + } |
779 | 791 | |
780 | 792 | /** |
781 | 793 | * Callback that autopromotes user according to the setting in |