r68620 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r68619‎ | r68620 | r68621 >
Date:06:42, 27 June 2010
Author:aaron
Status:ok
Tags:
Comment:
Cleaned up incrementRollbacks()
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
@@ -173,7 +173,7 @@
174174 'userpageBytes' => 0, # userpage is needed? with what min size?
175175 'uniqueIPAddress' => false, # If $wgPutIPinRC is true, users sharing IPs won't be promoted
176176 'neverBlocked' => true, # Can users that were blocked be promoted?
177 - 'maxRevertedEdits' => 5, # Max edits the user could have had rolled back?
 177+ 'maxRevertedEdits' => 5, # Max times the user could have edits undone/"rolled back"?
178178 );
179179
180180 # Define when users get to have their own edits auto-reviewed. Set to false to disable.
Index: trunk/extensions/FlaggedRevs/FlaggedRevs.hooks.php
@@ -1112,14 +1112,17 @@
11131113 }
11141114
11151115 public static function incrementRollbacks(
1116 - $article, $user, $target, Revision $current
 1116+ Article $article, $user, $goodRev, Revision $badRev
11171117 ) {
11181118 # Mark when a user reverts another user, but not self-reverts
1119 - if ( $current->getRawUser() && $user->getId() != $current->getRawUser() ) {
1120 - $p = FlaggedRevs::getUserParams( $current->getRawUser() );
1121 - $p['revertedEdits'] = isset( $p['revertedEdits'] ) ? $p['revertedEdits'] : 0;
 1119+ $badUserId = $badRev->getRawUser();
 1120+ if ( $badUserId && $user->getId() != $badUserId ) {
 1121+ $p = FlaggedRevs::getUserParams( $badUserId );
 1122+ if ( !isset( $p['revertedEdits'] ) ) {
 1123+ $p['revertedEdits'] = 0;
 1124+ }
11221125 $p['revertedEdits']++;
1123 - FlaggedRevs::saveUserParams( $current->getRawUser(), $p );
 1126+ FlaggedRevs::saveUserParams( $badUserId, $p );
11241127 }
11251128 return true;
11261129 }

Status & tagging log