-
Notifications
You must be signed in to change notification settings - Fork 805
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
MU WPCOM: Add more defensive checks when loading the Coming Soon feature #41273
MU WPCOM: Add more defensive checks when loading the Coming Soon feature #41273
Conversation
Are you an Automattician? Please test your changes on all WordPress.com environments to help mitigate accidental explosions.
Interested in more tips and information?
|
Thank you for your PR! When contributing to Jetpack, we have a few suggestions that can help us test and review your patch:
This comment will be updated as you work on your PR and make changes. If you think that some of those checks are not needed for your PR, please explain why you think so. Thanks for cooperation 🤖 The e2e test report can be found here. Please note that it can take a few minutes after the e2e tests checks are complete for the report to be available. Follow this PR Review Process:
Still unsure? Reach out in #jetpack-developers for guidance! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
✅ Smoke-tested the Coming Soon functionality.
*/ | ||
$invalid_fse_version_active = | ||
is_plugin_active( 'full-site-editing/full-site-editing-plugin.php' ) && | ||
version_compare( get_plugin_data( WP_PLUGIN_DIR . '/full-site-editing/full-site-editing-plugin.php', false )['Version'], '3.56084', '<' ); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmmm.... could it have actually broken sites that "On WoA sites, users may be using non-symlinked older versions of the FSE plugin."
ref:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tested and works as expected.
If we have any concerns, we can check whether the plugin is installed first before checking whether it's active
Updated the PR to ensure that the FSE file exist before calling get_plugin_data(). |
is_plugin_active( 'full-site-editing/full-site-editing-plugin.php' ) && | ||
version_compare( get_plugin_data( WP_PLUGIN_DIR . '/full-site-editing/full-site-editing-plugin.php', false )['Version'], '3.56084', '<' ); | ||
is_plugin_active( $fse_plugin ) && | ||
file_exists( $fse_plugin_path ) && |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looks like we have to check it before is_plugin_active
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IIRC is_plugin_active() checks site options, but moving it in front doesn't hurt 🙂
The issue is that full-site-editing/full-site-editing-plugin.php
is still in site options but the plugin file doesn't exist anymore.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
Proposed changes:
This PR adds more checks in the ETK version comparison to ensure that the plugin file exists before calling the function
get_plugin_data()
.Other information:
Jetpack product discussion
Does this pull request change what data or activity we track or use?
Testing instructions:
Smoke-test the Coming Soon functionality.