build: Update mediawiki/mediawiki-codesniffer to 0.10.1
[lhc/web/wiklou.git] / includes / changes / RecentChange.php
index dcab158..5fad8fd 100644 (file)
@@ -130,7 +130,7 @@ class RecentChange {
                if ( is_array( $type ) ) {
                        $retval = [];
                        foreach ( $type as $t ) {
-                               $retval[] = RecentChange::parseToRCType( $t );
+                               $retval[] = self::parseToRCType( $t );
                        }
 
                        return $retval;
@@ -459,7 +459,7 @@ class RecentChange {
 
                $change = $change instanceof RecentChange
                        ? $change
-                       : RecentChange::newFromId( $change );
+                       : self::newFromId( $change );
 
                if ( !$change instanceof RecentChange ) {
                        return null;
@@ -874,7 +874,7 @@ class RecentChange {
                        'rc_logid' => 0,
                        'rc_log_type' => null,
                        'rc_log_action' => '',
-                       'rc_params' =>  serialize( [
+                       'rc_params' => serialize( [
                                'hidden-cat' => WikiCategoryPage::factory( $categoryTitle )->isHidden()
                        ] )
                ];
@@ -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 );
+                       }
+               }
        }
 
        /**