| @@ 218-230 (lines=13) @@ | ||
| 215 | 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 ); |
|
| 216 | } |
|
| 217 | ||
| 218 | public function estimate_full_sync_actions( $config ) { |
|
| 219 | global $wpdb; |
|
| 220 | ||
| 221 | $query = "SELECT count(*) FROM $wpdb->usermeta"; |
|
| 222 | ||
| 223 | if ( $where_sql = $this->get_where_sql( $config ) ) { |
|
| 224 | $query .= ' WHERE ' . $where_sql; |
|
| 225 | } |
|
| 226 | ||
| 227 | $count = $wpdb->get_var( $query ); |
|
| 228 | ||
| 229 | return (int) ceil( $count / self::ARRAY_CHUNK_SIZE ); |
|
| 230 | } |
|
| 231 | ||
| 232 | private function get_where_sql( $config ) { |
|
| 233 | global $wpdb; |
|
| @@ 85-97 (lines=13) @@ | ||
| 82 | 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 ); |
|
| 83 | } |
|
| 84 | ||
| 85 | public function estimate_full_sync_actions( $config ) { |
|
| 86 | global $wpdb; |
|
| 87 | ||
| 88 | $query = "SELECT count(*) FROM $wpdb->comments"; |
|
| 89 | ||
| 90 | if ( $where_sql = $this->get_where_sql( $config ) ) { |
|
| 91 | $query .= ' WHERE ' . $where_sql; |
|
| 92 | } |
|
| 93 | ||
| 94 | $count = $wpdb->get_var( $query ); |
|
| 95 | ||
| 96 | return (int) ceil( $count / self::ARRAY_CHUNK_SIZE ); |
|
| 97 | } |
|
| 98 | ||
| 99 | private function get_where_sql( $config ) { |
|
| 100 | if ( is_array( $config ) ) { |
|