change some rc_new to rc_type == RC_NEW
authorumherirrender <umherirrender_de.wp@web.de>
Sun, 5 Aug 2012 22:08:35 +0000 (00:08 +0200)
committerumherirrender <umherirrender_de.wp@web.de>
Sun, 5 Aug 2012 22:08:35 +0000 (00:08 +0200)
The field rc_new is obsolete and should be removed, see bug 34320

Change-Id: I411ec2cb0fe3eb078094eded210d4aefee5f8e74

includes/ChangesList.php
includes/RecentChange.php
includes/api/ApiQueryRecentChanges.php
includes/api/ApiQueryWatchlist.php

index 96a11e1..9daf3a9 100644 (file)
@@ -507,7 +507,7 @@ class ChangesList extends ContextSource {
         * @param $rc RecentChange
         */
        public function insertRollback( &$s, &$rc ) {
-               if( !$rc->mAttribs['rc_new'] && $rc->mAttribs['rc_this_oldid'] && $rc->mAttribs['rc_cur_id'] ) {
+               if( $rc->mAttribs['rc_type'] != RC_NEW && $rc->mAttribs['rc_this_oldid'] && $rc->mAttribs['rc_cur_id'] ) {
                        $page = $rc->getTitle();
                        /** Check for rollback and edit permissions, disallow special pages, and only
                          * show a link on the top-most revision */
@@ -548,7 +548,7 @@ class ChangesList extends ContextSource {
                if ( !$rc->mAttribs['rc_patrolled'] ) {
                        if ( $this->getUser()->useRCPatrol() ) {
                                $unpatrolled = true;
-                       } elseif ( $this->getUser()->useNPPatrol() && $rc->mAttribs['rc_new'] ) {
+                       } elseif ( $this->getUser()->useNPPatrol() && $rc->mAttribs['rc_type'] == RC_NEW ) {
                                $unpatrolled = true;
                        }
                }
@@ -613,7 +613,7 @@ class OldChangesList extends ChangesList {
                        # M, N, b and ! (minor, new, bot and unpatrolled)
                        $s .= $this->recentChangesFlags(
                                array(
-                                       'newpage' => $rc->mAttribs['rc_new'],
+                                       'newpage' => $rc->mAttribs['rc_type'] == RC_NEW,
                                        'minor' => $rc->mAttribs['rc_minor'],
                                        'unpatrolled' => $unpatrolled,
                                        'bot' => $rc->mAttribs['rc_bot']
@@ -868,7 +868,7 @@ class EnhancedChangesList extends ChangesList {
                $allLogs = true;
                foreach( $block as $rcObj ) {
                        $oldid = $rcObj->mAttribs['rc_last_oldid'];
-                       if( $rcObj->mAttribs['rc_new'] ) {
+                       if( $rcObj->mAttribs['rc_type'] == RC_NEW ) {
                                $isnew = true;
                        }
                        // If all log actions to this page were hidden, then don't
@@ -1028,7 +1028,7 @@ class EnhancedChangesList extends ChangesList {
 
                        $r .= '<tr><td></td><td class="mw-enhanced-rc">';
                        $r .= $this->recentChangesFlags( array(
-                               'newpage' => $rcObj->mAttribs['rc_new'],
+                               'newpage' => $type == RC_NEW,
                                'minor' => $rcObj->mAttribs['rc_minor'],
                                'unpatrolled' => $rcObj->unpatrolled,
                                'bot' => $rcObj->mAttribs['rc_bot'],
index 4a7bafd..288dd3e 100644 (file)
@@ -734,10 +734,10 @@ class RecentChange {
                } else {
                        $comment = self::cleanupForIRC( $this->mAttribs['rc_comment'] );
                        $flag = '';
-                       if ( !$this->mAttribs['rc_patrolled'] && ( $wgUseRCPatrol || $this->mAttribs['rc_new'] && $wgUseNPPatrol ) ) {
+                       if ( !$this->mAttribs['rc_patrolled'] && ( $wgUseRCPatrol || $this->mAttribs['rc_type'] == RC_NEW && $wgUseNPPatrol ) ) {
                                $flag .= '!';
                        }
-                       $flag .= ( $this->mAttribs['rc_new'] ? "N" : "" ) . ( $this->mAttribs['rc_minor'] ? "M" : "" ) . ( $this->mAttribs['rc_bot'] ? "B" : "" );
+                       $flag .= ( $this->mAttribs['rc_type'] == RC_NEW ? "N" : "" ) . ( $this->mAttribs['rc_minor'] ? "M" : "" ) . ( $this->mAttribs['rc_bot'] ? "B" : "" );
                }
 
                if ( $wgRC2UDPInterwikiPrefix === true && $wgLocalInterwiki !== false ) {
index 91d371b..7bb6bc5 100644 (file)
@@ -236,7 +236,7 @@ class ApiQueryRecentChanges extends ApiQueryGeneratorBase {
                        $this->addFieldsIf( 'rc_comment', $this->fld_comment || $this->fld_parsedcomment );
                        $this->addFieldsIf( 'rc_user', $this->fld_user );
                        $this->addFieldsIf( 'rc_user_text', $this->fld_user || $this->fld_userid );
-                       $this->addFieldsIf( array( 'rc_minor', 'rc_new', 'rc_bot' ) , $this->fld_flags );
+                       $this->addFieldsIf( array( 'rc_minor', 'rc_type', 'rc_bot' ) , $this->fld_flags );
                        $this->addFieldsIf( array( 'rc_old_len', 'rc_new_len' ), $this->fld_sizes );
                        $this->addFieldsIf( 'rc_patrolled', $this->fld_patrolled );
                        $this->addFieldsIf( array( 'rc_logid', 'rc_log_type', 'rc_log_action', 'rc_params' ), $this->fld_loginfo );
@@ -393,7 +393,7 @@ class ApiQueryRecentChanges extends ApiQueryGeneratorBase {
                        if ( $row->rc_bot ) {
                                $vals['bot'] = '';
                        }
-                       if ( $row->rc_new ) {
+                       if ( $row->rc_type == RC_NEW ) {
                                $vals['new'] = '';
                        }
                        if ( $row->rc_minor ) {
index 36644a4..a1a3372 100644 (file)
@@ -96,7 +96,7 @@ class ApiQueryWatchlist extends ApiQueryGeneratorBase {
                                'rc_last_oldid',
                        ) );
 
-                       $this->addFieldsIf( array( 'rc_new', 'rc_minor', 'rc_bot' ), $this->fld_flags );
+                       $this->addFieldsIf( array( 'rc_type', 'rc_minor', 'rc_bot' ), $this->fld_flags );
                        $this->addFieldsIf( 'rc_user', $this->fld_user || $this->fld_userid );
                        $this->addFieldsIf( 'rc_user_text', $this->fld_user );
                        $this->addFieldsIf( 'rc_comment', $this->fld_comment || $this->fld_parsedcomment );
@@ -254,7 +254,7 @@ class ApiQueryWatchlist extends ApiQueryGeneratorBase {
                }
 
                if ( $this->fld_flags ) {
-                       if ( $row->rc_new ) {
+                       if ( $row->rc_type == RC_NEW ) {
                                $vals['new'] = '';
                        }
                        if ( $row->rc_minor ) {