| @@ 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 ) ) { |
|
| @@ 293-305 (lines=13) @@ | ||
| 290 | 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 ); |
|
| 291 | } |
|
| 292 | ||
| 293 | public function estimate_full_sync_actions( $config ) { |
|
| 294 | global $wpdb; |
|
| 295 | ||
| 296 | $query = "SELECT count(*) FROM $wpdb->usermeta"; |
|
| 297 | ||
| 298 | if ( $where_sql = $this->get_where_sql( $config ) ) { |
|
| 299 | $query .= ' WHERE ' . $where_sql; |
|
| 300 | } |
|
| 301 | ||
| 302 | $count = $wpdb->get_var( $query ); |
|
| 303 | ||
| 304 | return (int) ceil( $count / self::ARRAY_CHUNK_SIZE ); |
|
| 305 | } |
|
| 306 | ||
| 307 | private function get_where_sql( $config ) { |
|
| 308 | global $wpdb; |
|