| @@ 109-121 (lines=13) @@ | ||
| 106 | 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 ); | |
| 107 | } | |
| 108 | ||
| 109 | 	public function estimate_full_sync_actions( $config ) { | |
| 110 | global $wpdb; | |
| 111 | ||
| 112 | $query = "SELECT count(*) FROM $wpdb->comments"; | |
| 113 | ||
| 114 | 		if ( $where_sql = $this->get_where_sql( $config ) ) { | |
| 115 | $query .= ' WHERE ' . $where_sql; | |
| 116 | } | |
| 117 | ||
| 118 | $count = $wpdb->get_var( $query ); | |
| 119 | ||
| 120 | return (int) ceil( $count / self::ARRAY_CHUNK_SIZE ); | |
| 121 | } | |
| 122 | ||
| 123 | 	private function get_where_sql( $config ) { | |
| 124 | 		if ( is_array( $config ) ) { | |
| @@ 393-405 (lines=13) @@ | ||
| 390 | 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 ); | |
| 391 | } | |
| 392 | ||
| 393 | 	public function estimate_full_sync_actions( $config ) { | |
| 394 | global $wpdb; | |
| 395 | ||
| 396 | $query = "SELECT count(*) FROM $wpdb->usermeta"; | |
| 397 | ||
| 398 | 		if ( $where_sql = $this->get_where_sql( $config ) ) { | |
| 399 | $query .= ' WHERE ' . $where_sql; | |
| 400 | } | |
| 401 | ||
| 402 | $count = $wpdb->get_var( $query ); | |
| 403 | ||
| 404 | return (int) ceil( $count / self::ARRAY_CHUNK_SIZE ); | |
| 405 | } | |
| 406 | ||
| 407 | 	private function get_where_sql( $config ) { | |
| 408 | global $wpdb; | |