Automattic\WooCommerce\Internal\Admin\Logging\FileV2
FileController::export_single_file
Stream a single file to the browser without zipping it first.
Method of the class: FileController{}
No Hooks.
Returns
WP_Error|null. Only returns something if there is an error.
Usage
$FileController = new FileController(); $FileController->export_single_file( $file_id );
- $file_id(string) (required)
- A file ID (file basename without the hash).
FileController::export_single_file() FileController::export single file code WC 10.6.2
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();
}