From: addshore Date: Wed, 10 Feb 2016 09:38:41 +0000 (+0000) Subject: rc_old/new_len null for CategoryMembership RC change X-Git-Tag: 1.31.0-rc.0~7903^2 X-Git-Url: https://git.cyclocoop.org/%7B%24www_url%7Dadmin/compta/banques/%7B%7B%20url_for%28%27admin_users%27%29%20%7D%7D?a=commitdiff_plain;h=c940fa8ec1f965ea23a3eb8c2d1eeccd994c124b;p=lhc%2Fweb%2Fwiklou.git rc_old/new_len null for CategoryMembership RC change This will mean that EnhancedChangesList does not do odd things. Log changes also have this set to null This also adds a tiny bit of cleanup for the past which could be removed in a month or 2. This will fix all current RC entries as well as new ones. Once no old RC entires for CategoryMembership changes exist we can kill the type check. Bug: T126428 Change-Id: Ib19819373af70e10b0c750ffdb06156764b7fa3d --- diff --git a/includes/changes/EnhancedChangesList.php b/includes/changes/EnhancedChangesList.php index 1c49545759..06ce4f1eca 100644 --- a/includes/changes/EnhancedChangesList.php +++ b/includes/changes/EnhancedChangesList.php @@ -287,11 +287,19 @@ class EnhancedChangesList extends ChangesList { if ( $RCShowChangedSize && !$allLogs ) { $last = 0; $first = count( $block ) - 1; - # Some events (like logs) have an "empty" size, so we need to skip those... - while ( $last < $first && $block[$last]->mAttribs['rc_new_len'] === null ) { + # Some events (like logs and category changes) have an "empty" size, so we need to skip those... + while ( $last < $first && ( + $block[$last]->mAttribs['rc_new_len'] === null || + # TODO kill the below check after March 2016 - https://phabricator.wikimedia.org/T126428 + $block[$last]->mAttribs['rc_type'] == RC_CATEGORIZE + ) ) { $last++; } - while ( $first > $last && $block[$first]->mAttribs['rc_old_len'] === null ) { + while ( $last < $first && ( + $block[$first]->mAttribs['rc_old_len'] === null || + # TODO kill the below check after March 2016 - https://phabricator.wikimedia.org/T126428 + $block[$first]->mAttribs['rc_type'] == RC_CATEGORIZE + ) ) { $first--; } # Get net change diff --git a/includes/changes/RecentChange.php b/includes/changes/RecentChange.php index 9ae30c09a5..d2272652a8 100644 --- a/includes/changes/RecentChange.php +++ b/includes/changes/RecentChange.php @@ -828,8 +828,8 @@ class RecentChange { 'rc_ip' => self::checkIPAddress( $ip ), 'rc_patrolled' => 1, // Always patrolled, just like log entries 'rc_new' => 0, # obsolete - 'rc_old_len' => 0, - 'rc_new_len' => 0, + 'rc_old_len' => null, + 'rc_new_len' => null, 'rc_deleted' => $deleted, 'rc_logid' => 0, 'rc_log_type' => null,