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