r45395 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r45394‎ | r45395 | r45396 >
Date:12:38, 4 January 2009
Author:aaron
Status:deferred
Tags:
Comment:
Track # of rollbacked edits
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
@@ -208,6 +208,7 @@
209209 'userpageBytes' => 100, # if userpage is needed, what is the min size?
210210 'uniqueIPAddress' => false, # If $wgPutIPinRC is true, users sharing IPs won't be promoted
211211 'neverBlocked' => true, # Can users that were blocked be promoted?
 212+ 'maxRevertedEdits' => 5, # Max edits the user could have had rolled back? (not used yet)
212213 'noSorbsMatches' => false, # If $wgSorbsUrl is set, do not promote users that match
213214 );
214215
@@ -417,6 +418,8 @@
418419 # Autoreview stuff
419420 $wgHooks['EditPage::showEditForm:fields'][] = 'FlaggedRevsHooks::addRevisionIDField';
420421 $wgHooks['EditPageBeforeEditChecks'][] = 'FlaggedRevsHooks::addReviewCheck';
 422+# User stats
 423+$wgHooks['ArticleRollbackComplete'][] = 'FlaggedRevsHooks::incrementRollbacks';
421424
422425 # Add CSS/JS as needed
423426 $wgHooks['OutputPageParserOutput'][] = 'FlaggedRevsHooks::injectStyleAndJS';
Index: trunk/extensions/FlaggedRevs/FlaggedRevs.hooks.php
@@ -775,6 +775,18 @@
776776 }
777777 return true;
778778 }
 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+ }
779791
780792 /**
781793 * Callback that autopromotes user according to the setting in

Status & tagging log