Code Duplication    Length = 13-13 lines in 2 locations

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

@@ 52-64 (lines=13) @@
49
		return $this->enqueue_all_ids_as_action( 'jetpack_full_sync_comments', $wpdb->comments, 'comment_ID', $this->get_where_sql( $config ) );
50
	}
51
52
	public function estimate_full_sync_actions( $config ) {
53
		global $wpdb;
54
55
		$query = "SELECT count(*) FROM $wpdb->comments";
56
		
57
		if ( $where_sql = $this->get_where_sql( $config ) ) {
58
			$query .= ' WHERE ' . $where_sql;
59
		}
60
61
		$count = $wpdb->get_var( $query );
62
63
		return (int) ceil( $count / self::ARRAY_CHUNK_SIZE );
64
	}
65
66
	private function get_where_sql( $config ) {
67
		if ( is_array( $config ) ) {

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

@@ 161-173 (lines=13) @@
158
		return $this->enqueue_all_ids_as_action( 'jetpack_full_sync_users', $wpdb->users, 'ID', $this->get_where_sql( $config ) );
159
	}
160
161
	public function estimate_full_sync_actions( $config ) {
162
		global $wpdb;
163
164
		$query = "SELECT count(*) FROM $wpdb->users";
165
		
166
		if ( $where_sql = $this->get_where_sql( $config ) ) {
167
			$query .= ' WHERE ' . $where_sql;
168
		}
169
170
		$count = $wpdb->get_var( $query );
171
172
		return (int) ceil( $count / self::ARRAY_CHUNK_SIZE );
173
	}
174
175
	private function get_where_sql( $config ) {
176
		// config is a list of user IDs to sync