Revert f88586e
but add supporting logging.
This commit is contained in:
parent
1947c80c21
commit
dc3589f0e3
|
@ -340,6 +340,13 @@ class WC_Download_Handler {
|
|||
}
|
||||
|
||||
// Fallback.
|
||||
wc_get_logger()->warning(
|
||||
sprintf(
|
||||
/* translators: %1$s contains the filepath of the digital asset. */
|
||||
__( '%1$s could not be served using the X-Accel-Redirect/X-Sendfile method. A Force Download will be used instead.', 'woocommerce' ),
|
||||
$file_path
|
||||
)
|
||||
);
|
||||
self::download_file_force( $file_path, $filename );
|
||||
}
|
||||
|
||||
|
@ -435,7 +442,18 @@ class WC_Download_Handler {
|
|||
$start = isset( $download_range['start'] ) ? $download_range['start'] : 0;
|
||||
$length = isset( $download_range['length'] ) ? $download_range['length'] : 0;
|
||||
if ( ! self::readfile_chunked( $parsed_file_path['file_path'], $start, $length ) ) {
|
||||
self::download_error( __( 'File not found', 'woocommerce' ) );
|
||||
if ( $parsed_file_path['remote_file'] ) {
|
||||
wc_get_logger()->warning(
|
||||
sprintf(
|
||||
/* translators: %1$s contains the filepath of the digital asset. */
|
||||
__( '%1$s could not be served using the Force Download method. A redirect will be used instead.', 'woocommerce' ),
|
||||
$file_path
|
||||
)
|
||||
);
|
||||
self::download_file_redirect( $file_path );
|
||||
} else {
|
||||
self::download_error( __( 'File not found', 'woocommerce' ) );
|
||||
}
|
||||
}
|
||||
|
||||
exit;
|
||||
|
|
Loading…
Reference in New Issue