diff --git a/src/wp-admin/includes/privacy-tools.php b/src/wp-admin/includes/privacy-tools.php
index 7e2badcb4e..5b7a04a8b3 100644
a
|
b
|
function wp_privacy_generate_personal_data_export_file( $request_id ) { |
401 | 401 | */ |
402 | 402 | $error = false; |
403 | 403 | $archive_url = get_post_meta( $request_id, '_export_file_url', true ); |
| 404 | $archive_filename = get_post_meta( $request_id, '_export_file_name', true ); |
404 | 405 | $archive_pathname = get_post_meta( $request_id, '_export_file_path', true ); |
405 | 406 | |
406 | | if ( empty( $archive_pathname ) || empty( $archive_url ) ) { |
| 407 | if ( empty( $archive_filename ) && ! empty( $archive_pathname ) ) { |
| 408 | $archive_filename = basename( $archive_pathname ); |
| 409 | |
| 410 | update_post_meta( $request_id, '_export_file_name', wp_normalize_path( $archive_filename ) ); |
| 411 | delete_post_meta( $request_id, '_export_file_path' ); |
| 412 | |
| 413 | if ( ! empty( $archive_pathname ) && file_exists( $archive_pathname ) ) { |
| 414 | wp_delete_file( $archive_pathname ); |
| 415 | } |
| 416 | |
| 417 | } elseif ( empty( $archive_pathname ) || empty( $archive_url ) ) { |
407 | 418 | $archive_filename = $file_basename . '.zip'; |
408 | | $archive_pathname = $exports_dir . $archive_filename; |
409 | 419 | $archive_url = $exports_url . $archive_filename; |
410 | 420 | |
411 | 421 | update_post_meta( $request_id, '_export_file_url', $archive_url ); |
412 | | update_post_meta( $request_id, '_export_file_path', wp_normalize_path( $archive_pathname ) ); |
| 422 | update_post_meta( $request_id, '_export_file_name', wp_normalize_path( $archive_filename ) ); |
413 | 423 | } |
414 | 424 | |
| 425 | $archive_pathname = $exports_dir . $archive_filename; |
| 426 | |
415 | 427 | if ( ! empty( $archive_pathname ) && file_exists( $archive_pathname ) ) { |
416 | 428 | wp_delete_file( $archive_pathname ); |
417 | 429 | } |