| @@ 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; |
|
| @@ 63-75 (lines=13) @@ | ||
| 60 | return $this->enqueue_all_ids_as_action( 'jetpack_full_sync_comments', $wpdb->comments, 'comment_ID', $this->get_where_sql( $config ) ); |
|
| 61 | } |
|
| 62 | ||
| 63 | public function estimate_full_sync_actions( $config ) { |
|
| 64 | global $wpdb; |
|
| 65 | ||
| 66 | $query = "SELECT count(*) FROM $wpdb->comments"; |
|
| 67 | ||
| 68 | if ( $where_sql = $this->get_where_sql( $config ) ) { |
|
| 69 | $query .= ' WHERE ' . $where_sql; |
|
| 70 | } |
|
| 71 | ||
| 72 | $count = $wpdb->get_var( $query ); |
|
| 73 | ||
| 74 | return (int) ceil( $count / self::ARRAY_CHUNK_SIZE ); |
|
| 75 | } |
|
| 76 | ||
| 77 | private function get_where_sql( $config ) { |
|
| 78 | if ( is_array( $config ) ) { |
|