Skip to content

Commit b4819f6

Browse files
authored
Merge branch 'WordPress:trunk' into trunk
2 parents 189d301 + f04cb62 commit b4819f6

4 files changed

Lines changed: 528 additions & 1 deletion

File tree

src/wp-admin/includes/privacy-tools.php

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,13 @@ function _wp_personal_data_cleanup_requests() {
204204
'fields' => 'ids',
205205
'date_query' => array(
206206
array(
207-
'column' => 'post_modified_gmt',
207+
/*
208+
* The local-time column must be used here, not post_modified_gmt:
209+
* WP_Date_Query resolves relative date strings like "N seconds ago"
210+
* in the site's timezone, so comparing against the GMT column would
211+
* shift the expiry window by the site's UTC offset.
212+
*/
213+
'column' => 'post_modified',
208214
'before' => $expires . ' seconds ago',
209215
),
210216
),

src/wp-includes/default-filters.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -464,6 +464,8 @@
464464
add_filter( 'wp_privacy_personal_data_erasers', 'wp_register_comment_personal_data_eraser' );
465465
add_action( 'init', 'wp_schedule_delete_old_privacy_export_files' );
466466
add_action( 'wp_privacy_delete_old_export_files', 'wp_privacy_delete_old_export_files' );
467+
add_action( 'init', 'wp_schedule_personal_data_cleanup_requests' );
468+
add_action( 'wp_privacy_personal_data_cleanup_requests', 'wp_privacy_personal_data_cleanup_requests' );
467469

468470
// Cron tasks.
469471
add_action( 'wp_scheduled_delete', 'wp_scheduled_delete' );

src/wp-includes/functions.php

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8507,6 +8507,38 @@ function wp_schedule_delete_old_privacy_export_files() {
85078507
}
85088508
}
85098509

8510+
/**
8511+
* Schedules a WP-Cron job to clean up personal data requests.
8512+
*
8513+
* @since 7.1.0
8514+
*
8515+
* @see wp_privacy_personal_data_cleanup_requests()
8516+
*/
8517+
function wp_schedule_personal_data_cleanup_requests(): void {
8518+
if ( wp_installing() ) {
8519+
return;
8520+
}
8521+
8522+
if ( ! wp_next_scheduled( 'wp_privacy_personal_data_cleanup_requests' ) ) {
8523+
wp_schedule_event( time(), 'daily', 'wp_privacy_personal_data_cleanup_requests' );
8524+
}
8525+
}
8526+
8527+
/**
8528+
* Fires the personal data cleanup requests handler during cron.
8529+
*
8530+
* Loads the admin privacy tools file if needed (e.g. during cron, where
8531+
* wp-admin/includes/privacy-tools.php is not loaded automatically).
8532+
*
8533+
* @since 7.1.0
8534+
*/
8535+
function wp_privacy_personal_data_cleanup_requests(): void {
8536+
if ( ! function_exists( '_wp_personal_data_cleanup_requests' ) ) {
8537+
require_once ABSPATH . 'wp-admin/includes/privacy-tools.php';
8538+
}
8539+
_wp_personal_data_cleanup_requests();
8540+
}
8541+
85108542
/**
85118543
* Cleans up export files older than three days old.
85128544
*

0 commit comments

Comments
 (0)