Make WordPress Core

Ticket #44195: 44195.2.diff

File 44195.2.diff, 1.0 KB (added by audrasjb, 8 years ago)

Fix: delete legacy index.html file

  • src/wp-admin/includes/file.php

    diff --git a/src/wp-admin/includes/file.php b/src/wp-admin/includes/file.php
    index 4535684..62c8448 100644
    a b function wp_privacy_generate_personal_data_export_file( $request_id ) {  
    20302030                wp_send_json_error( __( 'Unable to create export folder.' ) );
    20312031        }
    20322032
    2033         // Protect export folder from browsing.
    2034         $index_pathname = $exports_dir . 'index.html';
     2033        // Protect export folder from browsing and delete legacy index.html file.
     2034        $legacy_index_pathname = $exports_dir . 'index.html';
     2035        $index_pathname = $exports_dir . 'index.php';
     2036        if ( file_exists( $legacy_index_pathname ) ) {
     2037                unlink( $legacy_index_pathname );
     2038        }
    20352039        if ( ! file_exists( $index_pathname ) ) {
    20362040                $file = fopen( $index_pathname, 'w' );
    20372041                if ( false === $file ) {
    20382042                        wp_send_json_error( __( 'Unable to protect export folder from browsing.' ) );
    20392043                }
    2040                 fwrite( $file, 'Silence is golden.' );
     2044                fwrite( $file, "<?php \n");
     2045                fwrite( $file, "// Silence is golden." );
    20412046                fclose( $file );
    20422047        }
    20432048