r98232 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r98231‎ | r98232 | r98233 >
Date:17:28, 27 September 2011
Author:catrope
Status:old
Tags:
Comment:
1.17wmf1: Experimental counter drift fix for AFT, much simpler approach than r96722
Modified paths:
  • /branches/wmf/1.17wmf1/extensions/ArticleFeedback/api/ApiArticleFeedback.php (modified) (history)

Diff [purge]

Index: branches/wmf/1.17wmf1/extensions/ArticleFeedback/api/ApiArticleFeedback.php
@@ -164,6 +164,13 @@
165165 */
166166 private function insertRevisionRating( $pageId, $revisionId, $lastRevision, $ratingId, $updateAddition, $thisRating, $lastRating ) {
167167 $dbw = wfGetDB( DB_MASTER );
 168+
 169+ // Fix previous logic bug: if the revision IDs of the previous and current ratings are NOT the same,
 170+ // set $lastRating to zero. Otherwise we will try to adjust instead of add, which may result in negative
 171+ // values and wrap-arounds and all that sort of nastiness.
 172+ if ( $revisionId != $lastRevision ) {
 173+ $lastRating = 0;
 174+ }
168175
169176 // Try to insert a new "totals" row for this page,rev,rating set
170177 $dbw->insert(
@@ -182,7 +189,8 @@
183190 // If that succeded in inserting a row, then we are for sure rating a previously unrated
184191 // revision, and we need to add more information about this rating to the new "totals" row,
185192 // as well as remove the previous rating values from the previous "totals" row
186 - if ( $dbw->affectedRows() ) {
 193+ // HACK: This behavior is stupid, don't do this
 194+ if ( $dbw->affectedRows() && false ) {
187195 // If there was a previous rating, there should be a "totals" row for it's revision
188196 if ( $lastRating ) {
189197 // Deduct the previous rating values from the previous "totals" row

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r96722Epic followup to r94404, r94509: change the ArticleFeedback schema such that ...catrope15:26, 10 September 2011

Status & tagging log