Make WordPress Core


Ignore:
Timestamp:
05/15/2018 08:32:01 PM (7 years ago)
Author:
azaozz
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.
Merges [43284] to the 4.9 branch.
Fixes #44091.

Location:
branches/4.9
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/4.9

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

    r43235 r43285  
    18871887
    18881888    // Create the exports folder if needed.
    1889     $upload_dir  = wp_upload_dir();
    1890     $exports_dir = trailingslashit( $upload_dir['basedir'] . '/exports' );
    1891     $exports_url = trailingslashit( $upload_dir['baseurl'] . '/exports' );
     1889    $exports_dir = wp_privacy_exports_dir();
     1890    $exports_url = wp_privacy_exports_url();
    18921891
    18931892    $result = wp_mkdir_p( $exports_dir );
Note: See TracChangeset for help on using the changeset viewer.