| @@ 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 ) ) { |
|
| @@ 247-259 (lines=13) @@ | ||
| 244 | 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 ); |
|
| 245 | } |
|
| 246 | ||
| 247 | public function estimate_full_sync_actions( $config ) { |
|
| 248 | global $wpdb; |
|
| 249 | ||
| 250 | $query = "SELECT count(*) FROM $wpdb->usermeta"; |
|
| 251 | ||
| 252 | if ( $where_sql = $this->get_where_sql( $config ) ) { |
|
| 253 | $query .= ' WHERE ' . $where_sql; |
|
| 254 | } |
|
| 255 | ||
| 256 | $count = $wpdb->get_var( $query ); |
|
| 257 | ||
| 258 | return (int) ceil( $count / self::ARRAY_CHUNK_SIZE ); |
|
| 259 | } |
|
| 260 | ||
| 261 | private function get_where_sql( $config ) { |
|
| 262 | global $wpdb; |
|