Changeset 48330 for trunk/src/wp-admin/includes/privacy-tools.php
- Timestamp:
- 07/06/2020 12:32:15 AM (5 years ago)
- File:
-
- 1 edited
-
trunk/src/wp-admin/includes/privacy-tools.php (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-admin/includes/privacy-tools.php
r48302 r48330 278 278 } 279 279 280 if ( 1 < $groups_count) {280 if ( $groups_count > 1 ) { 281 281 $group_html .= '<div class="return-to-top">'; 282 282 $group_html .= '<a href="#top"><span aria-hidden="true">↑ </span> ' . esc_html__( 'Return to top' ) . '</a>'; … … 434 434 435 435 // Create TOC. 436 if ( 1 < $groups_count) {436 if ( $groups_count > 1 ) { 437 437 fwrite( $file, '<div id="table_of_contents">' ); 438 438 fwrite( $file, '<h2>' . esc_html__( 'Table of Contents' ) . '</h2>' ); … … 465 465 * Now, generate the ZIP. 466 466 * 467 * If an archive has already been generated, then remove it and reuse the 468 * filename, to avoid breaking any URLs that may have been previously sent 469 * via email. 467 * If an archive has already been generated, then remove it and reuse the filename, 468 * to avoid breaking any URLs that may have been previously sent via email. 470 469 */ 471 470 $error = false; 472 471 473 // This postmeta is used from version 5.4.472 // This meta value is used from version 5.5. 474 473 $archive_filename = get_post_meta( $request_id, '_export_file_name', true ); 475 474 476 // These are used for backward compatibility. 477 $archive_url = get_post_meta( $request_id, '_export_file_url', true ); 475 // This one stored an absolute path and is used for backward compatibility. 478 476 $archive_pathname = get_post_meta( $request_id, '_export_file_path', true ); 479 477 480 // If a rchive_filename exists, make sure to remove deprecated postmeta.478 // If a filename meta exists, use it. 481 479 if ( ! empty( $archive_filename ) ) { 482 480 $archive_pathname = $exports_dir . $archive_filename; 483 $archive_url = $exports_url . $archive_filename;484 485 // Remove the deprecated postmeta.486 delete_post_meta( $request_id, '_export_file_url' );487 delete_post_meta( $request_id, '_export_file_path' );488 481 } elseif ( ! empty( $archive_pathname ) ) { 489 // Check if archive_pathname exists. If not, create the new postmeta and remove the deprecated.482 // If a full path meta exists, use it and create the new meta value. 490 483 $archive_filename = basename( $archive_pathname ); 491 $archive_url = $exports_url . $archive_filename; 492 493 // Add the new postmeta that is used since version 5.4. 494 update_post_meta( $request_id, '_export_file_name', wp_normalize_path( $archive_filename ) ); 495 496 // Remove the deprecated postmeta. 484 485 update_post_meta( $request_id, '_export_file_name', $archive_filename ); 486 487 // Remove the back-compat meta values. 497 488 delete_post_meta( $request_id, '_export_file_url' ); 498 489 delete_post_meta( $request_id, '_export_file_path' ); 499 490 } else { 500 // If there's no archive_filename or archive_pathname create a new one.491 // If there's no filename or full path stored, create a new file. 501 492 $archive_filename = $file_basename . '.zip'; 502 $archive_url = $exports_url . $archive_filename;503 493 $archive_pathname = $exports_dir . $archive_filename; 504 494 505 // Add the new postmeta that is used since version 5.4. 506 update_post_meta( $request_id, '_export_file_name', wp_normalize_path( $archive_filename ) ); 507 508 // Remove the deprecated postmeta. 509 delete_post_meta( $request_id, '_export_file_url' ); 510 delete_post_meta( $request_id, '_export_file_path' ); 511 } 495 update_post_meta( $request_id, '_export_file_name', $archive_filename ); 496 } 497 498 $archive_url = $exports_url . $archive_filename; 512 499 513 500 if ( ! empty( $archive_pathname ) && file_exists( $archive_pathname ) ) { … … 569 556 $request = wp_get_user_request( $request_id ); 570 557 571 // Get the export file URL.572 $exports_url = wp_privacy_exports_url();573 $export_file_name = get_post_meta( $request_id, '_export_file_name', true );574 575 558 if ( ! $request || 'export_personal_data' !== $request->action_name ) { 576 559 return new WP_Error( 'invalid_request', __( 'Invalid request ID when sending personal data export email.' ) ); … … 590 573 $expiration_date = date_i18n( get_option( 'date_format' ), time() + $expiration ); 591 574 592 $export_file_url = $exports_url . $export_file_name; 593 $site_name = wp_specialchars_decode( get_option( 'blogname' ), ENT_QUOTES ); 594 $site_url = home_url(); 575 $exports_url = wp_privacy_exports_url(); 576 $export_file_name = get_post_meta( $request_id, '_export_file_name', true ); 577 $export_file_url = $exports_url . $export_file_name; 578 579 $site_name = wp_specialchars_decode( get_option( 'blogname' ), ENT_QUOTES ); 580 $site_url = home_url(); 595 581 596 582 /**
Note: See TracChangeset
for help on using the changeset viewer.