Code Duplication    Length = 5-7 lines in 8 locations

includes/api/ApiQueryAllRevisions.php 1 location

@@ 100-106 (lines=7) @@
97
		$dir = $params['dir'];
98
		$this->addTimestampWhereRange( 'rev_timestamp', $dir, $params['start'], $params['end'] );
99
100
		if ( $this->fld_tags ) {
101
			$this->addTables( 'tag_summary' );
102
			$this->addJoinConds(
103
				[ 'tag_summary' => [ 'LEFT JOIN', [ 'rev_id=ts_rev_id' ] ] ]
104
			);
105
			$this->addFields( 'ts_tags' );
106
		}
107
108
		if ( $this->fetchContent ) {
109
			$this->addTables( 'text' );

includes/api/ApiQueryDeletedRevisions.php 1 location

@@ 80-86 (lines=7) @@
77
			$this->addFields( [ 'ar_title', 'ar_namespace', 'ar_timestamp', 'ar_rev_id', 'ar_id' ] );
78
		}
79
80
		if ( $this->fld_tags ) {
81
			$this->addTables( 'tag_summary' );
82
			$this->addJoinConds(
83
				[ 'tag_summary' => [ 'LEFT JOIN', [ 'ar_rev_id=ts_rev_id' ] ] ]
84
			);
85
			$this->addFields( 'ts_tags' );
86
		}
87
88
		if ( !is_null( $params['tag'] ) ) {
89
			$this->addTables( 'change_tag' );

includes/api/ApiQueryDeletedrevs.php 1 location

@@ 135-141 (lines=7) @@
132
		$this->addFieldsIf( 'ar_len', $fld_len );
133
		$this->addFieldsIf( 'ar_sha1', $fld_sha1 );
134
135
		if ( $fld_tags ) {
136
			$this->addTables( 'tag_summary' );
137
			$this->addJoinConds(
138
				[ 'tag_summary' => [ 'LEFT JOIN', [ 'ar_rev_id=ts_rev_id' ] ] ]
139
			);
140
			$this->addFields( 'ts_tags' );
141
		}
142
143
		if ( !is_null( $params['tag'] ) ) {
144
			$this->addTables( 'change_tag' );

includes/api/ApiQueryLogEvents.php 1 location

@@ 97-101 (lines=5) @@
94
		$this->addFieldsIf( 'log_comment', $this->fld_comment || $this->fld_parsedcomment );
95
		$this->addFieldsIf( 'log_params', $this->fld_details );
96
97
		if ( $this->fld_tags ) {
98
			$this->addTables( 'tag_summary' );
99
			$this->addJoinConds( [ 'tag_summary' => [ 'LEFT JOIN', 'log_id=ts_log_id' ] ] );
100
			$this->addFields( 'ts_tags' );
101
		}
102
103
		if ( !is_null( $params['tag'] ) ) {
104
			$this->addTables( 'change_tag' );

includes/api/ApiQueryRevisions.php 1 location

@@ 154-160 (lines=7) @@
151
			$this->addFields( [ 'rev_id', 'rev_timestamp', 'rev_page' ] );
152
		}
153
154
		if ( $this->fld_tags ) {
155
			$this->addTables( 'tag_summary' );
156
			$this->addJoinConds(
157
				[ 'tag_summary' => [ 'LEFT JOIN', [ 'rev_id=ts_rev_id' ] ] ]
158
			);
159
			$this->addFields( 'ts_tags' );
160
		}
161
162
		if ( $params['tag'] !== null ) {
163
			$this->addTables( 'change_tag' );

includes/api/ApiQueryRecentChanges.php 1 location

@@ 301-305 (lines=5) @@
298
		$this->addFieldsIf( [ 'rc_this_oldid' ],
299
			$resultPageSet && $params['generaterevisions'] );
300
301
		if ( $this->fld_tags ) {
302
			$this->addTables( 'tag_summary' );
303
			$this->addJoinConds( [ 'tag_summary' => [ 'LEFT JOIN', [ 'rc_id=ts_rc_id' ] ] ] );
304
			$this->addFields( 'ts_tags' );
305
		}
306
307
		if ( $this->fld_sha1 ) {
308
			$this->addTables( 'revision' );

includes/api/ApiQueryAllDeletedRevisions.php 1 location

@@ 122-128 (lines=7) @@
119
			}
120
		}
121
122
		if ( $this->fld_tags ) {
123
			$this->addTables( 'tag_summary' );
124
			$this->addJoinConds(
125
				[ 'tag_summary' => [ 'LEFT JOIN', [ 'ar_rev_id=ts_rev_id' ] ] ]
126
			);
127
			$this->addFields( 'ts_tags' );
128
		}
129
130
		if ( !is_null( $params['tag'] ) ) {
131
			$this->addTables( 'change_tag' );

includes/api/ApiQueryUserContributions.php 1 location

@@ 326-332 (lines=7) @@
323
		$this->addFieldsIf( 'rev_parent_id', $this->fld_flags || $this->fld_sizediff || $this->fld_ids );
324
		$this->addFieldsIf( 'rc_patrolled', $this->fld_patrolled );
325
326
		if ( $this->fld_tags ) {
327
			$this->addTables( 'tag_summary' );
328
			$this->addJoinConds(
329
				[ 'tag_summary' => [ 'LEFT JOIN', [ 'rev_id=ts_rev_id' ] ] ]
330
			);
331
			$this->addFields( 'ts_tags' );
332
		}
333
334
		if ( isset( $this->params['tag'] ) ) {
335
			$this->addTables( 'change_tag' );