Privacy: Correct the error check when creating an export folder in wp_privacy_generate_personal_data_export_file().

`wp_mkdir_p()` returns `false` on error, not a `WP_Error` object.

Props birgire.
Merges [43299] to the 4.9 branch.
Fixes #44158.

git-svn-id: https://develop.svn.wordpress.org/branches/4.9@43300 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Sergey Biryukov 2018-05-21 12:01:40 +00:00
parent 6ed010dc57
commit e563e309e2

View File

@ -1889,9 +1889,8 @@ function wp_privacy_generate_personal_data_export_file( $request_id ) {
$exports_dir = wp_privacy_exports_dir(); $exports_dir = wp_privacy_exports_dir();
$exports_url = wp_privacy_exports_url(); $exports_url = wp_privacy_exports_url();
$result = wp_mkdir_p( $exports_dir ); if ( ! wp_mkdir_p( $exports_dir ) ) {
if ( is_wp_error( $result ) ) { wp_send_json_error( __( 'Unable to create export folder.' ) );
wp_send_json_error( $result->get_error_message() );
} }
// Protect export folder from browsing. // Protect export folder from browsing.