if ( is_array( $type ) ) {
$retval = [];
foreach ( $type as $t ) {
- $retval[] = RecentChange::parseToRCType( $t );
+ $retval[] = self::parseToRCType( $t );
}
return $retval;
$change = $change instanceof RecentChange
? $change
- : RecentChange::newFromId( $change );
+ : self::newFromId( $change );
if ( !$change instanceof RecentChange ) {
return null;
'rc_logid' => 0,
'rc_log_type' => null,
'rc_log_action' => '',
- 'rc_params' => serialize( [
+ 'rc_params' => serialize( [
'hidden-cat' => WikiCategoryPage::factory( $categoryTitle )->isHidden()
] )
];
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 );
+ }
+ }
}
/**