#61450 closed defect (bug) (fixed)
The `recovery_mode_clean_expired_keys` cron event is orphaned after converting to Multisite
| Reported by: |
|
Owned by: |
|
|---|---|---|---|
| Milestone: | 6.8 | Priority: | low |
| Severity: | minor | Version: | 5.2 |
| Component: | Cron API | Keywords: | has-patch |
| Focuses: | multisite | Cc: |
Description
To reproduce:
- Create a single site installation
- Convert it to a Multisite installation, for example via
wp core multisite-convertor via the Tools -> Network Setup menu - Observe that the
recovery_mode_clean_expired_keyscron event is still scheduled to run daily but that it does not have a registered callback and is therefore useless
To view the callbacks for a cron event hook you can use the WP Crontrol plugin or run some code such as has_action('recovery_mode_clean_expired_keys').
This cron event is orphaned because recovery mode is not operational on a Multisite installation, therefore the WP_Recovery_Mode class isn't instantiated.
Ideally the recovery_mode_clean_expired_keys cron event would be deleted upon installation of Multisite.
Change History (11)
This ticket was mentioned in PR #6835 on WordPress/wordpress-develop by @narenin.
20 months ago
#1
- Keywords has-patch added; needs-patch removed
#2
@
20 months ago
Hi @johnbillion
I have submitted the PR with patch, could you please take a look.
This ticket was mentioned in PR #8225 on WordPress/wordpress-develop by @debarghyabanerjee.
13 months ago
#4
- Keywords has-patch added; needs-patch removed
Trac Ticket: Core-61450
## Description
- This update adds functionality inside the populate_network() function to remove the recovery_mode_clean_expired_keys cron event. Since Recovery Mode is not used in a Multisite environment, this cron event is no longer necessary. Removing it ensures that unnecessary scheduled tasks are not running.
## Changes
- Cron Event Removal: The following code has been added inside the populate_network() function to clear the recovery_mode_clean_expired_keys cron event if it's scheduled.
## Why This Is Necessary
The recovery_mode_clean_expired_keys cron event is intended for cleaning expired recovery keys in single-site installations. It is not required in a Multisite environment, and clearing it ensures that unnecessary cron jobs are not scheduled, thus improving overall performance.
@debarghyabanerjee commented on PR #8225:
13 months ago
#5
Hi @johnbillion , can you please take a look into this PR.
13 months ago
#6
@johnbillion I have implemented the suggested changes, could you please take the look.
@johnbillion commented on PR #8225:
13 months ago
#7
Thanks so much for the PR @Debarghya-Banerjee 🙇
- What are the steps to test this please?
- What's the need for two calls to
wp_clear_scheduled_hook?
@debarghyabanerjee commented on PR #8225:
13 months ago
#8
Hi @johnbillion, thanks for reaching out, and sorry for the late reply.
- I have followed the same steps that you have mentioned to reproduce the issue to test my Patch.
After making the changes, I followed the following steps:
- Created a single site installation
- Converted it to a Multisite installation, using
wp core multisite-convert
- Checked and verified that the
recovery_mode_clean_expired_keyscron event is not scheduled to run daily.
Please let me know in case of any doubts. Thanks
#9
@
12 months ago
- Milestone changed from Awaiting Review to 6.8
- Owner set to johnbillion
- Status changed from new to reviewing
@johnbillion commented on PR #8225:
12 months ago
#11
A commit was made that fixes the Trac ticket referenced in the description of this pull request.
SVN changeset: 59798
GitHub commit: https://github.com/WordPress/wordpress-develop/commit/9b1724271d53a93af3ff7022edd5e710d9193fb5
Trac ticket: https://core.trac.wordpress.org/ticket/61450