@@ 246-261 (lines=16) @@ | ||
243 | * @param array $config Full sync configuration for this sync module. |
|
244 | * @return int Number of items yet to be enqueued. |
|
245 | */ |
|
246 | public function estimate_full_sync_actions( $config ) { |
|
247 | global $wpdb; |
|
248 | ||
249 | $query = "SELECT count(*) FROM $wpdb->comments"; |
|
250 | ||
251 | $where_sql = $this->get_where_sql( $config ); |
|
252 | if ( $where_sql ) { |
|
253 | $query .= ' WHERE ' . $where_sql; |
|
254 | } |
|
255 | ||
256 | // TODO: Call $wpdb->prepare on the following query. |
|
257 | // phpcs:ignore WordPress.DB.PreparedSQL.NotPrepared |
|
258 | $count = $wpdb->get_var( $query ); |
|
259 | ||
260 | return (int) ceil( $count / self::ARRAY_CHUNK_SIZE ); |
|
261 | } |
|
262 | ||
263 | /** |
|
264 | * Retrieve the WHERE SQL clause based on the module config. |
@@ 173-187 (lines=15) @@ | ||
170 | * @param array $config Full sync configuration for this sync module. |
|
171 | * @return int Number of items yet to be enqueued. |
|
172 | */ |
|
173 | public function estimate_full_sync_actions( $config ) { |
|
174 | global $wpdb; |
|
175 | ||
176 | $query = "SELECT count(*) FROM $wpdb->term_taxonomy"; |
|
177 | ||
178 | $where_sql = $this->get_where_sql( $config ); |
|
179 | if ( $where_sql ) { |
|
180 | $query .= ' WHERE ' . $where_sql; |
|
181 | } |
|
182 | ||
183 | // phpcs:disable WordPress.DB.PreparedSQL.NotPrepared |
|
184 | $count = $wpdb->get_var( $query ); |
|
185 | ||
186 | return (int) ceil( $count / self::ARRAY_CHUNK_SIZE ); |
|
187 | } |
|
188 | ||
189 | /** |
|
190 | * Retrieve the actions that will be sent for this module during a full sync. |
@@ 641-655 (lines=15) @@ | ||
638 | * @param array $config Full sync configuration for this sync module. |
|
639 | * @return array Number of items yet to be enqueued. |
|
640 | */ |
|
641 | public function estimate_full_sync_actions( $config ) { |
|
642 | global $wpdb; |
|
643 | ||
644 | $query = "SELECT count(*) FROM $wpdb->usermeta"; |
|
645 | ||
646 | $where_sql = $this->get_where_sql( $config ); |
|
647 | if ( $where_sql ) { |
|
648 | $query .= ' WHERE ' . $where_sql; |
|
649 | } |
|
650 | ||
651 | // phpcs:ignore WordPress.DB.PreparedSQL.NotPrepared |
|
652 | $count = $wpdb->get_var( $query ); |
|
653 | ||
654 | return (int) ceil( $count / self::ARRAY_CHUNK_SIZE ); |
|
655 | } |
|
656 | ||
657 | /** |
|
658 | * Retrieve the WHERE SQL clause based on the module config. |