( $id_field, $table, $where, $batch_size ); if ( empty( $result->min ) && empty( $result->max ) ) { // Our query produced no min and max. We can assume the min from the previous query, // and the total max we found in the initial query. $current_max = (int) $total->max; $result = (object) array( 'min' => $current_min, 'max' => $current_max, ); } else { $current_min = (int) $result->min; $current_max = (int) $result->max; } $results[] = $result; } return $results; } /** * Return Total number of objects. * * @param array $config Full Sync config. * * @return int total */ public function total( $config ) { global $wpdb; $table = $wpdb->{$this->table_name()}; $where = $this->get_where_sql( $config ); // phpcs:ignore WordPress.DB.PreparedSQL.InterpolatedNotPrepared return $wpdb->get_var( "SELECT COUNT(*) FROM $table WHERE $where" ); } /** * Retrieve the WHERE SQL clause based on the module config. * * @access public * * @param array $config Full sync configuration for this sync module. * @return string WHERE SQL clause, or `null` if no comments are specified in the module config. */ public function get_where_sql( $config ) { // phpcs:ignore VariableAnalysis.CodeAnalysis.VariableAnalysis.UnusedVariable return '1=1'; } }