Code Duplication    Length = 21-21 lines in 2 locations

sync/class.jetpack-sync-wp-replicastore.php 2 locations

@@ 43-63 (lines=21) @@
40
		// noop right now
41
	}
42
43
	public function post_count( $status = null, $min_id = null, $max_id = null ) {
44
		global $wpdb;
45
46
		$where = '';
47
48
		if ( $status ) {
49
			$where = "post_status = '" . esc_sql( $status ) . "'";
50
		} else {
51
			$where = '1=1';
52
		}
53
54
		if ( null != $min_id ) {
55
			$where .= ' AND ID >= ' . intval( $min_id );
56
		}
57
58
		if ( null != $max_id ) {
59
			$where .= ' AND ID <= ' . intval( $max_id );
60
		}
61
62
		return $wpdb->get_var( "SELECT COUNT(*) FROM $wpdb->posts WHERE $where" );
63
	}
64
65
	// TODO: actually use max_id/min_id
66
	public function get_posts( $status = null, $min_id = null, $max_id = null ) {
@@ 159-179 (lines=21) @@
156
		return $this->table_checksum( $wpdb->postmeta, Jetpack_Sync_Defaults::$default_post_meta_checksum_columns, 'meta_id', Jetpack_Sync_Settings::get_whitelisted_post_meta_sql(), $min_id, $max_id );
157
	}
158
159
	public function comment_count( $status = null, $min_id = null, $max_id = null ) {
160
		global $wpdb;
161
162
		$comment_approved = $this->comment_status_to_approval_value( $status );
163
164
		if ( $comment_approved !== false ) {
165
			$where = "comment_approved = '" . esc_sql( $comment_approved ) . "'";
166
		} else {
167
			$where = '1=1';
168
		}
169
170
		if ( $min_id != null ) {
171
			$where .= ' AND comment_ID >= ' . intval( $min_id );
172
		}
173
174
		if ( $max_id != null ) {
175
			$where .= ' AND comment_ID <= ' . intval( $max_id );
176
		}
177
178
		return $wpdb->get_var( "SELECT COUNT(*) FROM $wpdb->comments WHERE $where" );
179
	}
180
181
	private function comment_status_to_approval_value( $status ) {
182
		switch ( $status ) {