[44498] Privacy: Schedule a daily cron job for personal data cleanup.#12049
[44498] Privacy: Schedule a daily cron job for personal data cleanup.#12049nimesh-xecurify wants to merge 8 commits into
Conversation
This introduces `wp_schedule_personal_data_cleanup_requests()` to automatically transition expired personal data requests to a "failed" state via WP-Cron. The update also fixes a timezone bug in `_wp_personal_data_cleanup_requests()` where using `post_modified_gmt` in a relative date query caused requests to expire at the wrong time on sites with a UTC offset. Switching to `post_modified` ensures the relative "seconds ago" comparison remains consistent with the site's local time.
|
The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the Core Committers: Use this line as a base for the props when committing in SVN: To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
Test using WordPress PlaygroundThe changes in this pull request can previewed and tested using a WordPress Playground instance. WordPress Playground is an experimental project that creates a full WordPress instance entirely within the browser. Some things to be aware of
For more details about these limitations and more, check out the Limitations page in the WordPress Playground documentation. |
| * | ||
| * @since 7.1.0 | ||
| */ | ||
| function wp_schedule_personal_data_cleanup_requests() { |
There was a problem hiding this comment.
| function wp_schedule_personal_data_cleanup_requests() { | |
| function wp_schedule_personal_data_cleanup_requests(): void { |
| * | ||
| * @since 7.1.0 | ||
| */ | ||
| function wp_privacy_personal_data_cleanup_requests() { |
There was a problem hiding this comment.
| function wp_privacy_personal_data_cleanup_requests() { | |
| function wp_privacy_personal_data_cleanup_requests(): void { |
| * | ||
| * @var int | ||
| */ | ||
| private static $email_counter = 0; |
There was a problem hiding this comment.
| * | |
| * @var int | |
| */ | |
| private static $email_counter = 0; | |
| */ | |
| private static int $email_counter = 0; |
| /** | ||
| * Load privacy-tools.php (not auto-loaded outside admin) and reset cron. | ||
| */ | ||
| public function set_up() { |
There was a problem hiding this comment.
This method and the remaining in this class can have void added.
| public function set_up() { | |
| public function set_up(): void { |
| * @param string $hook | ||
| * @return array | ||
| */ | ||
| private function get_cron_events( $hook ) { |
There was a problem hiding this comment.
| private function get_cron_events( $hook ) { | |
| private function get_cron_events( string $hook ): array { |
Adds parameter and return type declarations to `wp_schedule_personal_data_cleanup_requests()`, `wp_privacy_personal_data_cleanup_requests()`, and their associated unit tests to improve type safety and align with modern coding standards.
…into 44498-privacy-cron-fix
|
PHPStan now reports zero rule level 10 errors on the changes in this PR. ✅ |
How does this PR relate to that one? Just seeing the ticket now has these two PRs. |
This introduces
wp_schedule_personal_data_cleanup_requests()to automatically transition expired personal data requests to a "failed" state via WP-Cron.The update also fixes a timezone bug in
_wp_personal_data_cleanup_requests()where usingpost_modified_gmtin a relative date query caused requests to expire at the wrong time on sites with a UTC offset. Switching topost_modifiedensures the relative "seconds ago" comparison remains consistent with the site's local time.Trac ticket: https://core.trac.wordpress.org/ticket/44498
PR Reference: #11444
Use of AI Tools
AI assistance: Yes
Tool(s): Claude Code
Model(s): Sonnet-4.6
Used for: Test suggestions; final implementation and tests were reviewed by me.