From cbfbadc99b3336ee0eeb4b3ea4f12a210f9daa41 Mon Sep 17 00:00:00 2001 From: Ian Dunn Date: Tue, 1 May 2018 17:42:50 +0000 Subject: [PATCH] Privacy: Include `wp-admin/includes/file.php` to avoid fatal error. `list_files()` is defined in `wp-admin/includes/file.php`, which is not included by `wp-cron.php`, so it needs to be included by the caller in order to avoid a fatal PHP error. This bug was not detected during testing because the file _is_ included when executing jobs via `wp cron event run`. Props mikejolley, iandunn. See #43546. See https://wordpress.slack.com/archives/C9695RJBW/p1525190405000860. git-svn-id: https://develop.svn.wordpress.org/trunk@43059 602fd350-edb4-49c9-b593-d223f7449a82 --- src/wp-includes/functions.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/wp-includes/functions.php b/src/wp-includes/functions.php index 647e0db2d0..a1af5dbbcc 100644 --- a/src/wp-includes/functions.php +++ b/src/wp-includes/functions.php @@ -6281,6 +6281,8 @@ 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' ); + $upload_dir = wp_upload_dir(); $exports_dir = trailingslashit( $upload_dir['basedir'] . '/exports' ); $export_files = list_files( $exports_dir, 100, array( 'index.html' ) );