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

@@ 184-196 (lines=13) @@
181
		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 );
182
	}
183
184
	public function estimate_full_sync_actions( $config ) {
185
		global $wpdb;
186
187
		$query = "SELECT count(*) FROM $wpdb->usermeta";
188
		
189
		if ( $where_sql = $this->get_where_sql( $config ) ) {
190
			$query .= ' WHERE ' . $where_sql;
191
		}
192
193
		$count = $wpdb->get_var( $query );
194
195
		return (int) ceil( $count / self::ARRAY_CHUNK_SIZE );
196
	}
197
198
	private function get_where_sql( $config ) {
199
		global $wpdb;