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.

git-svn-id: https://develop.svn.wordpress.org/trunk@44910 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Jonathan Desrosiers 2019-03-15 18:59:14 +00:00
parent 152e9d2b8f
commit 4db5347299
1 changed files with 5 additions and 2 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' ) );
/**