Fixed:The recovery_mode_clean_expired_keys cron event is orphaned after converting to Multisite#6835
Conversation
…er converting to Multisite
|
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. |
| add_action( 'wp_logout', array( $this, 'exit_recovery_mode' ) ); | ||
| add_action( 'login_form_' . self::EXIT_ACTION, array( $this, 'handle_exit_recovery_mode' ) ); | ||
| add_action( 'recovery_mode_clean_expired_keys', array( $this, 'clean_expired_keys' ) ); | ||
| add_action( 'wp_install', array( $this, 'remove_orphaned_recovery_mode_cron_event' ), 10, 1 ); |
There was a problem hiding this comment.
The function don't have argument 🤔
| // Check if we are in a Multisite installation. | ||
| if ( is_multisite() ) { | ||
| // Check if the cron event is scheduled. | ||
| $timestamp = wp_next_scheduled( 'recovery_mode_clean_expired_keys' ); |
There was a problem hiding this comment.
Hello @narenin,
I think it is better to use the wp_clear_scheduled_hook function instead of the wp_unschedule_event.
@mukeshpanchal27 Please share your opinions as well.
Thanks
johnbillion
left a comment
There was a problem hiding this comment.
@narenin Thanks for the PR. Are you sure that this works? The WP_Recovery_Mode class does not get instantiated when is_multisite() is true so this wp_install callback will never get called once Multisite is installed.
A better approach might be to call wp_clear_scheduled_hook( 'recovery_mode_clean_expired_keys' ) directly inside populate_network(). Needs testing though!
|
@johnbillion I have implemented the suggested changes, could you please take the look. |
Trac ticket: https://core.trac.wordpress.org/ticket/61450
This Pull Request is for code review only. Please keep all other discussion in the Trac ticket. Do not merge this Pull Request. See GitHub Pull Requests for Code Review in the Core Handbook for more details.