Code Duplication    Length = 13-13 lines in 2 locations

packages/sync/src/modules/Comments.php 1 location

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

packages/sync/src/modules/Users.php 1 location

@@ 392-404 (lines=13) @@
389
		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 );
390
	}
391
392
	public function estimate_full_sync_actions( $config ) {
393
		global $wpdb;
394
395
		$query = "SELECT count(*) FROM $wpdb->usermeta";
396
397
		if ( $where_sql = $this->get_where_sql( $config ) ) {
398
			$query .= ' WHERE ' . $where_sql;
399
		}
400
401
		$count = $wpdb->get_var( $query );
402
403
		return (int) ceil( $count / self::ARRAY_CHUNK_SIZE );
404
	}
405
406
	private function get_where_sql( $config ) {
407
		global $wpdb;