From: Aaron Schulz Date: Wed, 10 May 2017 02:50:46 +0000 (-0700) Subject: Avoid postgres CategoryMembershipChangeTest failures X-Git-Tag: 1.31.0-rc.0~3279^2 X-Git-Url: http://git.cyclocoop.org/%7B%24admin_url%7Dmes_infos.php?a=commitdiff_plain;h=116cadb8bbbbc1565aaa98a3311165f9ca42d3e2;p=lhc%2Fweb%2Fwiklou.git Avoid postgres CategoryMembershipChangeTest failures Strip out the redundant /32 CIDR suffix from the IP. Bug: T75174 Change-Id: If7738ab46c72babb51d3c306ce749a9ccfe34740 --- diff --git a/includes/changes/RecentChange.php b/includes/changes/RecentChange.php index 35f8b3b95e..e8e35a3839 100644 --- a/includes/changes/RecentChange.php +++ b/includes/changes/RecentChange.php @@ -911,7 +911,16 @@ class RecentChange { public function loadFromRow( $row ) { $this->mAttribs = get_object_vars( $row ); $this->mAttribs['rc_timestamp'] = wfTimestamp( TS_MW, $this->mAttribs['rc_timestamp'] ); - $this->mAttribs['rc_deleted'] = $row->rc_deleted; // MUST be set + // rc_deleted MUST be set + $this->mAttribs['rc_deleted'] = $row->rc_deleted; + + if ( isset( $this->mAttribs['rc_ip'] ) ) { + // Clean up CIDRs for Postgres per T164898. ("127.0.0.1" casts to "127.0.0.1/32") + $n = strpos( $this->mAttribs['rc_ip'], '/' ); + if ( $n !== false ) { + $this->mAttribs['rc_ip'] = substr( $this->mAttribs['rc_ip'], 0, $n ); + } + } } /**