WC_Product_CSV_Importer_Controller::dispatch_ajax_cleanup │ private static │ WC 1.0

Run one bounded pass of the post-import cleanup and tell the client where to resume.

The cursor only ever skips placeholders forward, and the queries it feeds match nothing but the importer's own temporary products, so it needs no server-side state of its own.

Метод класса: WC_Product_CSV_Importer_Controller{}

Хуков нет.

Возвращает

null. Ничего (null).

Использование

$result = WC_Product_CSV_Importer_Controller::dispatch_ajax_cleanup( $cursor ): void;
$cursor(int) (обязательный)
Highest placeholder ID earlier cleanup requests have examined.

Код WC_Product_CSV_Importer_Controller::dispatch_ajax_cleanup() WC 11.3.0

private static function dispatch_ajax_cleanup( int $cursor ): void {
	$next_cursor = self::cleanup_after_import( $cursor );

	$response = array(
		'position'            => null === $next_cursor ? 'done' : self::CLEANUP_POSITION_PREFIX . $next_cursor,
		'percentage'          => 100,
		'imported'            => 0,
		'imported_variations' => 0,
		'failed'              => 0,
		'updated'             => 0,
		'skipped'             => 0,
	);

	if ( null === $next_cursor ) {
		$response['url'] = add_query_arg( array( '_wpnonce' => wp_create_nonce( 'woocommerce-csv-importer' ) ), admin_url( 'edit.php?post_type=product&page=product_importer&step=done' ) );
	}

	wp_send_json_success( $response );
}