rc_old/new_len null for CategoryMembership RC change
authoraddshore <addshorewiki@gmail.com>
Wed, 10 Feb 2016 09:38:41 +0000 (09:38 +0000)
committerAddshore <addshorewiki@gmail.com>
Thu, 18 Feb 2016 16:09:30 +0000 (16:09 +0000)
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
includes/changes/RecentChange.php

index 1c49545..06ce4f1 100644 (file)
@@ -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
index 9ae30c0..d227265 100644 (file)
@@ -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,