Skip to content
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

Merged
merged 29 commits into from
Nov 18, 2024
Merged

Conversation

tbradsha
Copy link
Contributor

@tbradsha tbradsha commented Nov 14, 2024

This includes a variety of small cleanup tasks I ran across while scouring the codebase.

Proposed changes:

This PR includes the following:

Other information:

  • Have you written new tests for your changes, if applicable?
  • Have you checked the E2E test CI results, and verified that your changes do not break them?
  • Have you tested your changes on WordPress.com, if applicable (if so, you'll see a generated comment below with a script to run)?

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?

@tbradsha tbradsha added the DO NOT MERGE don't merge it! label Nov 14, 2024
@tbradsha tbradsha self-assigned this Nov 14, 2024
@github-actions github-actions bot added [Feature] Masterbar WordPress.com Toolbar and Dashboard customizations [mu wpcom Feature] Wpcom Blocks [Package] Assets [Package] Autoloader [Package] Changelogger [Package] Jetpack mu wpcom WordPress.com Features [Package] Masterbar [Package] Status [Plugin] Beta For serving live branches and the beta versions. https://github.com/automattic/jetpack-beta [Plugin] CRM Issues about the Jetpack CRM plugin [Plugin] Jetpack Issues about the Jetpack plugin. https://wordpress.org/plugins/jetpack/ [Plugin] Wpcomsh [Status] In Progress [Tests] Includes Tests labels Nov 14, 2024
Copy link
Contributor

github-actions bot commented Nov 14, 2024

Thank you for your PR!

When contributing to Jetpack, we have a few suggestions that can help us test and review your patch:

  • ✅ Include a description of your PR changes.
  • ✅ Add a "[Status]" label (In Progress, Needs Team Review, ...).
  • ✅ Add testing instructions.
  • ✅ Specify whether this PR includes any changes to data or privacy.
  • ✅ Add changelog entries to affected projects

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:

  1. Ensure all required checks appearing at the bottom of this PR are passing.
  2. Choose a review path based on your changes:
    • A. Team Review: add the "[Status] Needs Team Review" label
      • For most changes, including minor cross-team impacts.
      • Example: Updating a team-specific component or a small change to a shared library.
    • B. Crew Review: add the "[Status] Needs Review" label
      • For significant changes to core functionality.
      • Example: Major updates to a shared library or complex features.
    • C. Both: Start with Team, then request Crew
      • For complex changes or when you need extra confidence.
      • Example: Refactor affecting multiple systems.
  3. Get at least one approval before merging.

Still unsure? Reach out in #jetpack-developers for guidance!


Beta plugin:

  • Next scheduled release: none scheduled.

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:

  • WordPress.com Simple releases happen semi-continuously (PCYsg-Jjm-p2).
  • WoA releases happen weekly.
  • Releases to self-hosted sites happen monthly. The next release is scheduled for none scheduled (scheduled code freeze on undefined).

If you have any questions about the release process, please ask in the #jetpack-releases channel on Slack.


Vaultpress plugin:

  • Next scheduled release: none scheduled.

If you have any questions about the release process, please ask in the #jetpack-releases channel on Slack.


Super Cache plugin:

  • Next scheduled release: none scheduled.

If you have any questions about the release process, please ask in the #jetpack-releases channel on Slack.


Wpcomsh plugin:

  • Next scheduled release: Atomic deploys happen twice daily on weekdays (p9o2xV-2EN-p2).

If you have any questions about the release process, please ask in the #jetpack-releases channel on Slack.

Copy link
Contributor

github-actions bot commented Nov 14, 2024

Are you an Automattician? Please test your changes on all WordPress.com environments to help mitigate accidental explosions.

  • To test on WoA, go to the Plugins menu on a WordPress.com Simple site. Click on the "Upload" button and follow the upgrade flow to be able to upload, install, and activate the Jetpack Beta plugin. Once the plugin is active, go to Jetpack > Jetpack Beta, select your plugin, and enable the remove/pre_wp6.6_and_php7.2_code branch.

    • For jetpack-mu-wpcom changes, also add define( 'JETPACK_MU_WPCOM_LOAD_VIA_BETA_PLUGIN', true ); to your wp-config.php file.
  • To test on Simple, run the following command on your sandbox:

    bin/jetpack-downloader test jetpack remove/pre_wp6.6_and_php7.2_code
    
    bin/jetpack-downloader test jetpack-mu-wpcom-plugin remove/pre_wp6.6_and_php7.2_code
    

Interested in more tips and information?

  • In your local development environment, use the jetpack rsync command to sync your changes to a WoA dev blog.
  • Read more about our development workflow here: PCYsg-eg0-p2
  • Figure out when your changes will be shipped to customers here: PCYsg-eg5-p2

@github-actions github-actions bot added [Plugin] Super Cache A fast caching plugin for WordPress. [Plugin] VaultPress [Tools] Development CLI The tools/cli to assist during JP development. Actions GitHub actions used to automate some of the work around releases and repository management labels Nov 15, 2024
@tbradsha tbradsha marked this pull request as ready for review November 15, 2024 17:15
@tbradsha tbradsha requested a review from a team November 15, 2024 17:25
Copy link
Contributor

@anomiex anomiex left a 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:

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.

Copy link
Contributor

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.

Copy link
Contributor Author

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 ) {
Copy link
Contributor

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.

Copy link
Contributor Author

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
Copy link
Contributor

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:

Copy link
Contributor Author

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.

projects/packages/status/src/class-status.php Show resolved Hide resolved
tools/cli/commands/changelog.js Show resolved Hide resolved
@tbradsha tbradsha changed the title Janitorial: Various cleanup tasks that required WP 6.6 and/or PHP 7.2 Janitorial: Disparate cleanup tasks Nov 15, 2024
tbradsha and others added 3 commits November 15, 2024 14:20
Co-authored-by: Brad Jorsch <anomiex@users.noreply.github.com>
Co-authored-by: Brad Jorsch <anomiex@users.noreply.github.com>
@tbradsha
Copy link
Contributor Author

No need for composer 2.2 anymore with PHP 7.2 minimum.

Indeed, and the same goes with symfony/console and symfony/process (and probably others). I'm going to defer that to a separate PR, and I'm also not sure the best way to do it... 😅

Looks like I forgot this comment

82bfe8e

I'd be satisfied if the title and description are changed to encompass general cleanups

Adjusted.

@tbradsha tbradsha removed the DO NOT MERGE don't merge it! label Nov 18, 2024
Copy link
Contributor

@anomiex anomiex left a 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.

@tbradsha tbradsha merged commit d4ff610 into trunk Nov 18, 2024
73 checks passed
@tbradsha tbradsha deleted the remove/pre_wp6.6_and_php7.2_code branch November 18, 2024 16:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Actions GitHub actions used to automate some of the work around releases and repository management [Feature] Masterbar WordPress.com Toolbar and Dashboard customizations [mu wpcom Feature] Custom Css [mu wpcom Feature] Replace Site Visibility [mu wpcom Feature] Wpcom Blocks [Package] Assets [Package] Autoloader [Package] Changelogger [Package] Jetpack mu wpcom WordPress.com Features [Package] Masterbar [Package] Status [Plugin] Beta For serving live branches and the beta versions. https://github.com/automattic/jetpack-beta [Plugin] CRM Issues about the Jetpack CRM plugin [Plugin] Jetpack Issues about the Jetpack plugin. https://wordpress.org/plugins/jetpack/ [Plugin] Super Cache A fast caching plugin for WordPress. [Plugin] VaultPress [Plugin] Wpcomsh [Tests] Includes Tests [Tools] Development CLI The tools/cli to assist during JP development.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants