Code Duplication    Length = 19-22 lines in 2 locations

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

@@ 114-135 (lines=22) @@
111
		$this->set_status("options", 100);
112
	}
113
114
	private function enqueue_all_posts() {
115
		$this->set_status("posts", 0);
116
		global $wpdb;
117
118
		// I hope this is never bigger than RAM...
119
		$post_ids = $wpdb->get_col( "SELECT id FROM $wpdb->posts");
120
121
		// Request posts in groups of N for efficiency
122
		$chunked_post_ids = array_chunk( $post_ids, self::$array_chunk_size );
123
124
		$counter = 0;
125
		$total = count( $chunked_post_ids );
126
127
		// Send each chunk as an array of objects
128
		foreach ( $chunked_post_ids as $chunk ) {
129
			$this->set_status( "posts", ( $counter / $total ) * 100 );
130
			do_action( 'jetpack_full_sync_posts', $chunk );
131
			$counter += 1;
132
		}
133
134
		$this->set_status("posts", 100);
135
	}
136
137
	public function expand_post_ids( $args ) {
138
		$post_ids = $args[0];
@@ 157-175 (lines=19) @@
154
		);
155
	}
156
157
	private function enqueue_all_comments() {
158
		$this->set_status("comments", 0);
159
160
		global $wpdb;
161
162
		$comment_ids = $wpdb->get_col( "SELECT comment_id FROM $wpdb->comments");
163
		$chunked_comment_ids = array_chunk( $comment_ids, self::$array_chunk_size );
164
165
		$counter = 0;
166
		$total = count( $chunked_comment_ids );
167
168
		foreach ( $chunked_comment_ids as $chunk ) {
169
			$this->set_status( "comments", ( $counter / $total ) * 100 );
170
			do_action( 'jetpack_full_sync_comments', $chunk);
171
			$counter += 1;
172
		}
173
174
		$this->set_status("comments", 100);
175
	}
176
177
	public function expand_comment_ids( $args ) {
178
		$comment_ids = $args[0];