@@ 254-269 (lines=16) @@ | ||
251 | * @param array $config Full sync configuration for this sync module. |
|
252 | * @return int Number of items yet to be enqueued. |
|
253 | */ |
|
254 | public function estimate_full_sync_actions( $config ) { |
|
255 | global $wpdb; |
|
256 | ||
257 | $query = "SELECT count(*) FROM $wpdb->comments"; |
|
258 | ||
259 | $where_sql = $this->get_where_sql( $config ); |
|
260 | if ( $where_sql ) { |
|
261 | $query .= ' WHERE ' . $where_sql; |
|
262 | } |
|
263 | ||
264 | // TODO: Call $wpdb->prepare on the following query. |
|
265 | // phpcs:ignore WordPress.DB.PreparedSQL.NotPrepared |
|
266 | $count = $wpdb->get_var( $query ); |
|
267 | ||
268 | return (int) ceil( $count / self::ARRAY_CHUNK_SIZE ); |
|
269 | } |
|
270 | ||
271 | /** |
|
272 | * Retrieve the WHERE SQL clause based on the module config. |
@@ 180-194 (lines=15) @@ | ||
177 | * @param array $config Full sync configuration for this sync module. |
|
178 | * @return int Number of items yet to be enqueued. |
|
179 | */ |
|
180 | public function estimate_full_sync_actions( $config ) { |
|
181 | global $wpdb; |
|
182 | ||
183 | $query = "SELECT count(*) FROM $wpdb->term_taxonomy"; |
|
184 | ||
185 | $where_sql = $this->get_where_sql( $config ); |
|
186 | if ( $where_sql ) { |
|
187 | $query .= ' WHERE ' . $where_sql; |
|
188 | } |
|
189 | ||
190 | // phpcs:disable WordPress.DB.PreparedSQL.NotPrepared |
|
191 | $count = $wpdb->get_var( $query ); |
|
192 | ||
193 | return (int) ceil( $count / self::ARRAY_CHUNK_SIZE ); |
|
194 | } |
|
195 | ||
196 | /** |
|
197 | * Retrieve the actions that will be sent for this module during a full sync. |
@@ 649-663 (lines=15) @@ | ||
646 | * @param array $config Full sync configuration for this sync module. |
|
647 | * @return array Number of items yet to be enqueued. |
|
648 | */ |
|
649 | public function estimate_full_sync_actions( $config ) { |
|
650 | global $wpdb; |
|
651 | ||
652 | $query = "SELECT count(*) FROM $wpdb->usermeta"; |
|
653 | ||
654 | $where_sql = $this->get_where_sql( $config ); |
|
655 | if ( $where_sql ) { |
|
656 | $query .= ' WHERE ' . $where_sql; |
|
657 | } |
|
658 | ||
659 | // phpcs:ignore WordPress.DB.PreparedSQL.NotPrepared |
|
660 | $count = $wpdb->get_var( $query ); |
|
661 | ||
662 | return (int) ceil( $count / self::ARRAY_CHUNK_SIZE ); |
|
663 | } |
|
664 | ||
665 | /** |
|
666 | * Retrieve the WHERE SQL clause based on the module config. |