Automattic\WooCommerce\Internal\Admin\Logging\FileV2

FileController::export_single_file()publicWC 1.0

Stream a single file to the browser without zipping it first.

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

Хуков нет.

Возвращает

WP_Error|null. Only returns something if there is an error.

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

$FileController = new FileController();
$FileController->export_single_file( $file_id );
$file_id(строка) (обязательный)
A file ID (file basename without the hash).

Код FileController::export_single_file() WC 9.7.1

public function export_single_file( $file_id ) {
	$file = $this->get_file_by_id( $file_id );

	if ( is_wp_error( $file ) ) {
		return $file;
	}

	$file_name = $file->get_file_id() . '.log';
	$exporter  = new FileExporter( $file->get_path(), $file_name );

	return $exporter->emit_file();
}