| @@ 54-66 (lines=13) @@ | ||
| 51 | return $this->enqueue_all_ids_as_action( 'jetpack_full_sync_comments', $wpdb->comments, 'comment_ID', $this->get_where_sql( $config ) ); |
|
| 52 | } |
|
| 53 | ||
| 54 | public function estimate_full_sync_actions( $config ) { |
|
| 55 | global $wpdb; |
|
| 56 | ||
| 57 | $query = "SELECT count(*) FROM $wpdb->comments"; |
|
| 58 | ||
| 59 | if ( $where_sql = $this->get_where_sql( $config ) ) { |
|
| 60 | $query .= ' WHERE ' . $where_sql; |
|
| 61 | } |
|
| 62 | ||
| 63 | $count = $wpdb->get_var( $query ); |
|
| 64 | ||
| 65 | return (int) ceil( $count / self::ARRAY_CHUNK_SIZE ); |
|
| 66 | } |
|
| 67 | ||
| 68 | private function get_where_sql( $config ) { |
|
| 69 | if ( is_array( $config ) ) { |
|
| @@ 178-190 (lines=13) @@ | ||
| 175 | return $this->enqueue_all_ids_as_action( 'jetpack_full_sync_users', $wpdb->usermeta, 'user_id', $this->get_where_sql( $config ) ); |
|
| 176 | } |
|
| 177 | ||
| 178 | public function estimate_full_sync_actions( $config ) { |
|
| 179 | global $wpdb; |
|
| 180 | ||
| 181 | $query = "SELECT count(*) FROM $wpdb->usermeta"; |
|
| 182 | ||
| 183 | if ( $where_sql = $this->get_where_sql( $config ) ) { |
|
| 184 | $query .= ' WHERE ' . $where_sql; |
|
| 185 | } |
|
| 186 | ||
| 187 | $count = $wpdb->get_var( $query ); |
|
| 188 | ||
| 189 | return (int) ceil( $count / self::ARRAY_CHUNK_SIZE ); |
|
| 190 | } |
|
| 191 | ||
| 192 | private function get_where_sql( $config ) { |
|
| 193 | global $wpdb; |
|