Make WordPress Core


Ignore:
Timestamp:
05/15/2018 08:21:37 PM (8 years ago)
Author:
iandunn
Message:

Privacy: Rename exports folder to avoid deleting other files.

Previously, personal data exports were stored in wp-content/uploads/exports, which is generic enough that it's likely there are existing folders with that name, either created by plugins or manually by administrators. If that folder were reused by Core, then wp_privacy_delete_old_export_files() would delete all of the existing files inside it, which is almost certainly not what the site owner wants or expects.

To avoid that, the folder is being renamed to include a specific reference to Core, and a more verbose description of its purpose. With those factored in, it's very unlikely that there will be any conflicts with existing folders.

The wp_privacy_exports_dir() and wp_privacy_exports_url() functions were introduced to provide a canonical source for the location, and the wp_privacy_exports_dir and wp_privacy_exports_url filters were introduced to allow plugins to customize it.

Props johnjamesjacoby, allendav.
Fixes #44091.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-admin/includes/file.php

    r43234 r43284  
    20242024
    20252025    // Create the exports folder if needed.
    2026     $upload_dir  = wp_upload_dir();
    2027     $exports_dir = trailingslashit( $upload_dir['basedir'] . '/exports' );
    2028     $exports_url = trailingslashit( $upload_dir['baseurl'] . '/exports' );
     2026    $exports_dir = wp_privacy_exports_dir();
     2027    $exports_url = wp_privacy_exports_url();
    20292028
    20302029    $result = wp_mkdir_p( $exports_dir );
Note: See TracChangeset for help on using the changeset viewer.