From 53b5112ca297e22a60394dcd3d87e2172df86c78 Mon Sep 17 00:00:00 2001 From: Ian Dunn Date: Thu, 3 May 2018 21:11:00 +0000 Subject: [PATCH] Privacy: Return before scheduling cron during install to avoid error. r43046 introduced `wp_schedule_delete_old_privacy_export_files()` to schedule the `wp_privacy_delete_old_export_files` cron job, but it did not check to make sure it wasn't running in the context of the install process. When it did run in that context, it created a database error, because the necessary database tables don't exist at that point. Checking the current context and returning early during the installation phase avoids that issue. Props helen, timothyblynjacobs, iandunn. Fixes #43952. git-svn-id: https://develop.svn.wordpress.org/trunk@43162 602fd350-edb4-49c9-b593-d223f7449a82 --- src/wp-includes/functions.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/wp-includes/functions.php b/src/wp-includes/functions.php index 2af52513cd..616f0358fc 100644 --- a/src/wp-includes/functions.php +++ b/src/wp-includes/functions.php @@ -6264,6 +6264,10 @@ function _wp_privacy_active_plugins_change() { * @since 4.9.6 */ function wp_schedule_delete_old_privacy_export_files() { + if ( wp_installing() ) { + return; + } + if ( ! wp_next_scheduled( 'wp_privacy_delete_old_export_files' ) ) { wp_schedule_event( time(), 'hourly', 'wp_privacy_delete_old_export_files' ); }