Code Duplication    Length = 13-13 lines in 2 locations

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

@@ 100-112 (lines=13) @@
97
		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 );
98
	}
99
100
	public function estimate_full_sync_actions( $config ) {
101
		global $wpdb;
102
103
		$query = "SELECT count(*) FROM $wpdb->comments";
104
105
		if ( $where_sql = $this->get_where_sql( $config ) ) {
106
			$query .= ' WHERE ' . $where_sql;
107
		}
108
109
		$count = $wpdb->get_var( $query );
110
111
		return (int) ceil( $count / self::ARRAY_CHUNK_SIZE );
112
	}
113
114
	private function get_where_sql( $config ) {
115
		if ( is_array( $config ) ) {

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

@@ 276-288 (lines=13) @@
273
		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 );
274
	}
275
276
	public function estimate_full_sync_actions( $config ) {
277
		global $wpdb;
278
279
		$query = "SELECT count(*) FROM $wpdb->usermeta";
280
281
		if ( $where_sql = $this->get_where_sql( $config ) ) {
282
			$query .= ' WHERE ' . $where_sql;
283
		}
284
285
		$count = $wpdb->get_var( $query );
286
287
		return (int) ceil( $count / self::ARRAY_CHUNK_SIZE );
288
	}
289
290
	private function get_where_sql( $config ) {
291
		global $wpdb;