Make WordPress Core

Ticket #44038: 44038.4.diff

File 44038.4.diff, 1.7 KB (added by garrett-eclipse, 5 years ago)

Refresh to have indentation conform to CS

  • src/wp-admin/includes/privacy-tools.php

     
    416416         */
    417417        $error            = false;
    418418        $archive_url      = get_post_meta( $request_id, '_export_file_url', true );
     419        $archive_filename = get_post_meta( $request_id, '_export_file_name', true );
    419420        $archive_pathname = get_post_meta( $request_id, '_export_file_path', true );
    420421
    421         if ( empty( $archive_pathname ) || empty( $archive_url ) ) {
     422        if ( empty( $archive_filename ) && ! empty( $archive_pathname ) ) {
     423                $archive_filename = basename( $archive_pathname );
     424
     425                update_post_meta( $request_id, '_export_file_name', wp_normalize_path( $archive_filename ) );
     426                delete_post_meta( $request_id, '_export_file_path' );
     427
     428                if ( ! empty( $archive_pathname ) && file_exists( $archive_pathname ) ) {
     429                    wp_delete_file( $archive_pathname );
     430                }
     431               
     432        } elseif ( empty( $archive_pathname ) || empty( $archive_url ) ) {
     433               
    422434                $archive_filename = $file_basename . '.zip';
    423                 $archive_pathname = $exports_dir . $archive_filename;
    424435                $archive_url      = $exports_url . $archive_filename;
    425436
    426437                update_post_meta( $request_id, '_export_file_url', $archive_url );
    427                 update_post_meta( $request_id, '_export_file_path', wp_normalize_path( $archive_pathname ) );
     438                update_post_meta( $request_id, '_export_file_name', wp_normalize_path( $archive_filename ) );
    428439        }
    429440
     441        $archive_pathname = $exports_dir . $archive_filename;
     442
    430443        if ( ! empty( $archive_pathname ) && file_exists( $archive_pathname ) ) {
    431444                wp_delete_file( $archive_pathname );
    432445        }