Automattic\WooCommerce\Internal\Logging

OrderLogsDeletionProcessor::get_next_batch_to_process_cptprivateWC 1.0

Get the next batch of items to process, CPT datastore version.

Method of the class: OrderLogsDeletionProcessor{}

No Hooks.

Returns

Array.

Usage

// private - for code of main (parent) class only
$result = $this->get_next_batch_to_process_cpt( $size ): array;
$size(int) (required)
Maximum size of the batch to return.

OrderLogsDeletionProcessor::get_next_batch_to_process_cpt() code WC 10.8.1

private function get_next_batch_to_process_cpt( int $size ): array {
	global $wpdb;

	return $wpdb->get_results(
		$wpdb->prepare(
			"SELECT p.ID as order_id, pm.meta_value
                 FROM {$wpdb->postmeta} pm
                 INNER JOIN {$wpdb->posts} p ON pm.post_id = p.ID
                 WHERE pm.meta_key = %s
                 AND p.post_type = 'shop_order'
                 ORDER BY p.ID
                 LIMIT %d",
			'_debug_log_source_pending_deletion',
			$size
		),
		ARRAY_A
	);
}