-
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
Janitorial: Disparate cleanup tasks #40200
Conversation
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! Beta plugin:
If you have any questions about the release process, please ask in the #jetpack-releases channel on Slack. Jetpack plugin: The Jetpack plugin has different release cadences depending on the platform:
If you have any questions about the release process, please ask in the #jetpack-releases channel on Slack. Vaultpress plugin:
If you have any questions about the release process, please ask in the #jetpack-releases channel on Slack. Super Cache plugin:
If you have any questions about the release process, please ask in the #jetpack-releases channel on Slack. Wpcomsh plugin:
If you have any questions about the release process, please ask in the #jetpack-releases channel on Slack. |
Are you an Automattician? Please test your changes on all WordPress.com environments to help mitigate accidental explosions.
Interested in more tips and information?
|
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.
Spotted two more things to clean up:
- No need for composer 2.2 anymore with PHP 7.2 minimum.
"composer/composer": "^2.2 || ^2.4", - Looks like I forgot this comment in jetpack: Use better cipher in WPCOM Connection test #38393. 😀
jetpack/projects/plugins/jetpack/_inc/lib/debugger/class-jetpack-cxn-test-base.php
Line 514 in a792185
* @todo When PHP minimum is 5.3+, add cipher detection to use an agreed better cipher than RC4. RC4 should be the last resort.
Also, since the title of this PR is explicitly about the WP 6.6 / PHP 7.2 change, I flagged a bunch of stuff that isn't related to that. I'd be satisfied if the title and description are changed to encompass general cleanups instead of being so specific.
projects/packages/assets/changelog/remove-pre_wp6.6_and_php7.2_code
Outdated
Show resolved
Hide resolved
projects/packages/autoloader/changelog/remove-pre_wp6.6_and_php7.2_code
Outdated
Show resolved
Hide resolved
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.
This doesn't seem to have anything to do with the PHP 7.2 cleanup. Let's leave it for a separate PR, if we bother at all. Personally I don't really see the point to changing it from a deprecation warning to a throw before just removing it in a future major version bump.
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.
The reason I did this is because it has a major version bump forthcoming, and had this comment:
// @todo Sometime for a major version bump, have this throw instead. Then remove it for a major bump after that.
I'll defer to your final judgment. :^)
@@ -987,8 +987,7 @@ public static function update_custom_css_data( $args ) { | |||
public static function editor_max_image_size( $dims, $size = 'medium', $context = null ) { | |||
list( $width, $height ) = $dims; | |||
|
|||
// @phan-suppress-next-line PhanUndeclaredClassInCallable | |||
if ( class_exists( 'Jetpack' ) && is_callable( 'Jetpack::get_content_width' ) && 'large' === $size && 'edit' === $context ) { | |||
if ( class_exists( 'Jetpack' ) && 'large' === $size && 'edit' === $context ) { |
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 a reasonable change, but doesn't seem to have anything to do with the PHP 7.2 change. Same for the similar stuff below.
I wonder if we even need the class_exists( 'Jetpack' )
test? This seems to have been added in dd3b1d8 to try fixing static analysis.
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.
Changed PR title.
As for whether we need it, I wasn't confident enough in the load order and knowledge of the environment to know if there's an edge case where the class might not exist. 😓
@@ -11,8 +11,8 @@ | |||
* @return bool | |||
*/ | |||
function is_jetpack_connected() { | |||
// @phan-suppress-next-line PhanUndeclaredClassMethod, PhanUndeclaredClassInCallable | |||
return class_exists( 'Jetpack' ) && is_callable( 'Jetpack::is_connection_ready' ) && Jetpack::is_connection_ready(); | |||
// @phan-suppress-next-line PhanUndeclaredClassMethod |
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 a reasonable change, but doesn't seem to have anything to do with the PHP 7.2 change.
In this case, I don't see any indication as to why the is_callable
was added in a4dea90, although Phan may again be the reason.
The tricky part with adding a stub is that Simple has its own Jetpack class (fbhepr%2Skers%2Sjcpbz%2Sjc%2Qpbagrag%2Szh%2Qcyhtvaf%2Swrgcnpx%2Spynff.wrgcnpx.cuc%3Se%3Q37575q28-og) which doesn't entirely match Jetpack's, so whether we point to Jetpack's or make a stub from Simple's it'd be wrong for some environments. :sigh:
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.
Updated the PR title. Good to know about the Simple stub! At least in this case it still should be safe.
Co-authored-by: Brad Jorsch <anomiex@users.noreply.github.com>
Co-authored-by: Brad Jorsch <anomiex@users.noreply.github.com>
Indeed, and the same goes with
Adjusted. |
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 reasonable. Haven't tested though.
This includes a variety of small cleanup tasks I ran across while scouring the codebase.
Proposed changes:
This PR includes the following:
is_callable
checks: 6e6eab8, 0dd6d17, a6fefc3setMethods
→onlyMethods
: d7458f0private static
toprivate const
: 3240990packages/changelogger
deprecation to a throw: 0674faf, d143ebe, 2a6feeeOther information:
Jetpack product discussion
Does this pull request change what data or activity we track or use?
Testing instructions:
Do the changes make sense? Are CI checks happy?