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.

Built from https://develop.svn.wordpress.org/trunk@43059


git-svn-id: http://core.svn.wordpress.org/trunk@42888 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
iandunn 2018-05-01 17:43:22 +00:00
parent e0d2de94e7
commit 9bb0e18c82
2 changed files with 3 additions and 1 deletions

View File

@ -6281,6 +6281,8 @@ function wp_schedule_delete_old_privacy_export_files() {
* @since 4.9.6 * @since 4.9.6
*/ */
function wp_privacy_delete_old_export_files() { function wp_privacy_delete_old_export_files() {
require_once( ABSPATH . 'wp-admin/includes/file.php' );
$upload_dir = wp_upload_dir(); $upload_dir = wp_upload_dir();
$exports_dir = trailingslashit( $upload_dir['basedir'] . '/exports' ); $exports_dir = trailingslashit( $upload_dir['basedir'] . '/exports' );
$export_files = list_files( $exports_dir, 100, array( 'index.html' ) ); $export_files = list_files( $exports_dir, 100, array( 'index.html' ) );

View File

@ -4,7 +4,7 @@
* *
* @global string $wp_version * @global string $wp_version
*/ */
$wp_version = '5.0-alpha-43058'; $wp_version = '5.0-alpha-43059';
/** /**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema. * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.