Code Duplication    Length = 13-13 lines in 2 locations

sync/class.jetpack-sync-module-comments.php 1 location

@@ 67-79 (lines=13) @@
64
		return $this->enqueue_all_ids_as_action( 'jetpack_full_sync_comments', $wpdb->comments, 'comment_ID', $this->get_where_sql( $config ), $max_items_to_enqueue, $state );
65
	}
66
67
	public function estimate_full_sync_actions( $config ) {
68
		global $wpdb;
69
70
		$query = "SELECT count(*) FROM $wpdb->comments";
71
		
72
		if ( $where_sql = $this->get_where_sql( $config ) ) {
73
			$query .= ' WHERE ' . $where_sql;
74
		}
75
76
		$count = $wpdb->get_var( $query );
77
78
		return (int) ceil( $count / self::ARRAY_CHUNK_SIZE );
79
	}
80
81
	private function get_where_sql( $config ) {
82
		if ( is_array( $config ) ) {

sync/class.jetpack-sync-module-users.php 1 location

@@ 218-230 (lines=13) @@
215
		return $this->enqueue_all_ids_as_action( 'jetpack_full_sync_users', $wpdb->usermeta, 'user_id', $this->get_where_sql( $config ), $max_items_to_enqueue, $state );
216
	}
217
218
	public function estimate_full_sync_actions( $config ) {
219
		global $wpdb;
220
221
		$query = "SELECT count(*) FROM $wpdb->usermeta";
222
		
223
		if ( $where_sql = $this->get_where_sql( $config ) ) {
224
			$query .= ' WHERE ' . $where_sql;
225
		}
226
227
		$count = $wpdb->get_var( $query );
228
229
		return (int) ceil( $count / self::ARRAY_CHUNK_SIZE );
230
	}
231
232
	private function get_where_sql( $config ) {
233
		global $wpdb;