Make WordPress Core

Opened 20 months ago

Closed 12 months ago

Last modified 12 months ago

#61450 closed defect (bug) (fixed)

The `recovery_mode_clean_expired_keys` cron event is orphaned after converting to Multisite

Reported by: johnbillion's profile johnbillion Owned by: johnbillion's profile johnbillion
Milestone: 6.8 Priority: low
Severity: minor Version: 5.2
Component: Cron API Keywords: has-patch
Focuses: multisite Cc:

Description

To reproduce:

  1. Create a single site installation
  2. Convert it to a Multisite installation, for example via wp core multisite-convert or via the Tools -> Network Setup menu
  3. Observe that the recovery_mode_clean_expired_keys cron 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 @narenin
20 months ago

Hi @johnbillion

I have submitted the PR with patch, could you please take a look.

https://github.com/WordPress/wordpress-develop/pull/6835

#3 @johnbillion
13 months ago

  • Keywords needs-patch added; has-patch removed

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.

@narenin commented on PR #6835:


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_keys cron event is not scheduled to run daily.

Please let me know in case of any doubts. Thanks

#9 @johnbillion
12 months ago

  • Milestone changed from Awaiting Review to 6.8
  • Owner set to johnbillion
  • Status changed from new to reviewing

#10 @johnbillion
12 months ago

  • Resolution set to fixed
  • Status changed from reviewing to closed

In 59798:

Cron API: Clear the recovery_mode_clean_expired_keys cron event when converting a single site installation to Multisite.

This cron event is not used when Multisite is in use.

Props debarghyabanerjee, johnbillion, narenin

Fixes #61450

@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

Note: See TracTickets for help on using tickets.