Privacy: Do not attempt to cleanup personal data export files when the directory does not exist.

Checking for the presence of the directory and returning early prevents PHP warnings when attempting to list files in a non-existent directory.

Props arena, garrett-eclipse.
Fixes #45136.
Built from https://develop.svn.wordpress.org/trunk@44910


git-svn-id: http://core.svn.wordpress.org/trunk@44741 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
desrosj 2019-03-15 19:00:51 +00:00
parent 5ac3033d77
commit ecfb6fd700
2 changed files with 6 additions and 3 deletions

View File

@ -6712,9 +6712,12 @@ function wp_schedule_delete_old_privacy_export_files() {
* @since 4.9.6
*/
function wp_privacy_delete_old_export_files() {
require_once( ABSPATH . 'wp-admin/includes/file.php' );
$exports_dir = wp_privacy_exports_dir();
if ( ! is_dir( $exports_dir ) ) {
return;
}
$exports_dir = wp_privacy_exports_dir();
require_once( ABSPATH . 'wp-admin/includes/file.php' );
$export_files = list_files( $exports_dir, 100, array( 'index.html' ) );
/**

View File

@ -13,7 +13,7 @@
*
* @global string $wp_version
*/
$wp_version = '5.2-alpha-44909';
$wp_version = '5.2-alpha-44910';
/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.