Code Duplication    Length = 5-7 lines in 6 locations

includes/api/ApiQueryDeletedRevisions.php 1 location

@@ 88-94 (lines=7) @@
85
			$this->addFields( 'ts_tags' );
86
		}
87
88
		if ( !is_null( $params['tag'] ) ) {
89
			$this->addTables( 'change_tag' );
90
			$this->addJoinConds(
91
				[ 'change_tag' => [ 'INNER JOIN', [ 'ar_rev_id=ct_rev_id' ] ] ]
92
			);
93
			$this->addWhereFld( 'ct_tag', $params['tag'] );
94
		}
95
96
		if ( $this->fetchContent ) {
97
			// Modern MediaWiki has the content for deleted revs in the 'text'

includes/api/ApiQueryDeletedrevs.php 1 location

@@ 143-149 (lines=7) @@
140
			$this->addFields( 'ts_tags' );
141
		}
142
143
		if ( !is_null( $params['tag'] ) ) {
144
			$this->addTables( 'change_tag' );
145
			$this->addJoinConds(
146
				[ 'change_tag' => [ 'INNER JOIN', [ 'ar_rev_id=ct_rev_id' ] ] ]
147
			);
148
			$this->addWhereFld( 'ct_tag', $params['tag'] );
149
		}
150
151
		if ( $fld_content ) {
152
			// Modern MediaWiki has the content for deleted revs in the 'text'

includes/api/ApiQueryLogEvents.php 1 location

@@ 103-108 (lines=6) @@
100
			$this->addFields( 'ts_tags' );
101
		}
102
103
		if ( !is_null( $params['tag'] ) ) {
104
			$this->addTables( 'change_tag' );
105
			$this->addJoinConds( [ 'change_tag' => [ 'INNER JOIN',
106
				[ 'log_id=ct_log_id' ] ] ] );
107
			$this->addWhereFld( 'ct_tag', $params['tag'] );
108
		}
109
110
		if ( !is_null( $params['action'] ) ) {
111
			// Do validation of action param, list of allowed actions can contains wildcards

includes/api/ApiQueryRevisions.php 1 location

@@ 162-168 (lines=7) @@
159
			$this->addFields( 'ts_tags' );
160
		}
161
162
		if ( $params['tag'] !== null ) {
163
			$this->addTables( 'change_tag' );
164
			$this->addJoinConds(
165
				[ 'change_tag' => [ 'INNER JOIN', [ 'rev_id=ct_rev_id' ] ] ]
166
			);
167
			$this->addWhereFld( 'ct_tag', $params['tag'] );
168
		}
169
170
		if ( $this->fetchContent ) {
171
			// For each page we will request, the user must have read rights for that page

includes/api/ApiQueryRecentChanges.php 1 location

@@ 325-329 (lines=5) @@
322
			}
323
		}
324
325
		if ( !is_null( $params['tag'] ) ) {
326
			$this->addTables( 'change_tag' );
327
			$this->addJoinConds( [ 'change_tag' => [ 'INNER JOIN', [ 'rc_id=ct_rc_id' ] ] ] );
328
			$this->addWhereFld( 'ct_tag', $params['tag'] );
329
		}
330
331
		// Paranoia: avoid brute force searches (bug 17342)
332
		if ( !is_null( $params['user'] ) || !is_null( $params['excludeuser'] ) ) {

includes/api/ApiQueryAllDeletedRevisions.php 1 location

@@ 130-136 (lines=7) @@
127
			$this->addFields( 'ts_tags' );
128
		}
129
130
		if ( !is_null( $params['tag'] ) ) {
131
			$this->addTables( 'change_tag' );
132
			$this->addJoinConds(
133
				[ 'change_tag' => [ 'INNER JOIN', [ 'ar_rev_id=ct_rev_id' ] ] ]
134
			);
135
			$this->addWhereFld( 'ct_tag', $params['tag'] );
136
		}
137
138
		if ( $this->fetchContent ) {
139
			// Modern MediaWiki has the content for deleted revs in the 'text'