Code Duplication    Length = 19-23 lines in 2 locations

sync/class.jetpack-sync-full.php 2 locations

@@ 165-187 (lines=23) @@
162
		$this->set_status( 'terms', 100 );
163
	}
164
165
	private function enqueue_all_posts() {
166
		$this->set_status( 'posts', 0 );
167
		global $wpdb;
168
169
		// I hope this is never bigger than RAM...
170
		$post_type_sql = Jetpack_Sync_Defaults::get_blacklisted_post_types_sql();
171
		$post_ids      = $wpdb->get_col( "SELECT id FROM $wpdb->posts WHERE $post_type_sql" ); // Should we set a limit here?
172
173
		// Request posts in groups of N for efficiency
174
		$chunked_post_ids = array_chunk( $post_ids, self::$array_chunk_size );
175
176
		$counter = 0;
177
		$total   = count( $chunked_post_ids );
178
179
		// Send each chunk as an array of objects
180
		foreach ( $chunked_post_ids as $chunk ) {
181
			$this->set_status( 'posts', ( $counter / $total ) * 100 );
182
			do_action( 'jetpack_full_sync_posts', $chunk );
183
			$counter += 1;
184
		}
185
186
		$this->set_status( 'posts', 100 );
187
	}
188
189
	public function expand_post_ids( $args ) {
190
		$post_ids = $args[0];
@@ 202-220 (lines=19) @@
199
		);
200
	}
201
202
	private function enqueue_all_comments() {
203
		$this->set_status( 'comments', 0 );
204
205
		global $wpdb;
206
207
		$comment_ids         = $wpdb->get_col( "SELECT comment_id FROM $wpdb->comments" ); // Should we set a limit here?
208
		$chunked_comment_ids = array_chunk( $comment_ids, self::$array_chunk_size );
209
210
		$counter = 0;
211
		$total   = count( $chunked_comment_ids );
212
213
		foreach ( $chunked_comment_ids as $chunk ) {
214
			$this->set_status( 'comments', ( $counter / $total ) * 100 );
215
			do_action( 'jetpack_full_sync_comments', $chunk );
216
			$counter += 1;
217
		}
218
219
		$this->set_status( 'comments', 100 );
220
	}
221
222
	public function expand_comment_ids( $args ) {
223
		$comment_ids = $args[0];