Code Duplication    Length = 19-23 lines in 2 locations

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

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