From c940fa8ec1f965ea23a3eb8c2d1eeccd994c124b Mon Sep 17 00:00:00 2001 From: addshore Date: Wed, 10 Feb 2016 09:38:41 +0000 Subject: [PATCH] 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 --- includes/changes/EnhancedChangesList.php | 14 +++++++++++--- includes/changes/RecentChange.php | 4 ++-- 2 files changed, 13 insertions(+), 5 deletions(-) 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, -- 2.20.1