From 5d553e35a31546e1e0b40c9338ef5bfe9435d7e1 Mon Sep 17 00:00:00 2001 From: Sam Reed Date: Fri, 29 Jan 2010 14:38:57 +0000 Subject: [PATCH] Reduce code duplication by having tables added in all code paths, by adding before if --- includes/api/ApiQueryWatchlist.php | 28 ++++++++++------------------ 1 file changed, 10 insertions(+), 18 deletions(-) diff --git a/includes/api/ApiQueryWatchlist.php b/includes/api/ApiQueryWatchlist.php index 4f81734971..aea14ed209 100644 --- a/includes/api/ApiQueryWatchlist.php +++ b/includes/api/ApiQueryWatchlist.php @@ -91,14 +91,17 @@ class ApiQueryWatchlist extends ApiQueryGeneratorBase { $this->dieUsage( 'patrol property is not available', 'patrol' ); } } + + $this->addFields( array ( + 'rc_namespace', + 'rc_title', + 'rc_timestamp' + ) ); if ( is_null( $resultPageSet ) ) { $this->addFields( array ( 'rc_cur_id', - 'rc_this_oldid', - 'rc_namespace', - 'rc_title', - 'rc_timestamp' + 'rc_this_oldid' ) ); $this->addFieldsIf( 'rc_new', $this->fld_flags ); @@ -110,21 +113,10 @@ class ApiQueryWatchlist extends ApiQueryGeneratorBase { $this->addFieldsIf( 'rc_patrolled', $this->fld_patrol ); $this->addFieldsIf( 'rc_old_len', $this->fld_sizes ); $this->addFieldsIf( 'rc_new_len', $this->fld_sizes ); - } - elseif ( $params['allrev'] ) { - $this->addFields( array ( - 'rc_this_oldid', - 'rc_namespace', - 'rc_title', - 'rc_timestamp' - ) ); + } elseif ( $params['allrev'] ) { + $this->addFields( 'rc_this_oldid' ); } else { - $this->addFields( array ( - 'rc_cur_id', - 'rc_namespace', - 'rc_title', - 'rc_timestamp' - ) ); + $this->addFields( 'rc_cur_id' ); } $this->addTables( array ( -- 2.20.1