Avoid postgres CategoryMembershipChangeTest failures

Strip out the redundant /32 CIDR suffix from the IP.

Bug: T75174
Change-Id: If7738ab46c72babb51d3c306ce749a9ccfe34740
This commit is contained in:
Aaron Schulz 2017-05-09 19:50:46 -07:00 committed by Krinkle
parent 3d26a96478
commit 116cadb8bb

View file

@ -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 );
}
}
}
/**