Skip to content

Boost: run module status change routine on plugin activation#43168

Merged
jeherve merged 3 commits intotrunkfrom
update/boost-reactivate-setup
Apr 22, 2025
Merged

Boost: run module status change routine on plugin activation#43168
jeherve merged 3 commits intotrunkfrom
update/boost-reactivate-setup

Conversation

@jeherve
Copy link
Copy Markdown
Member

@jeherve jeherve commented Apr 21, 2025

Fixes #41718
Fixes HOG-20

Proposed changes:

When the plugin is activated:

  1. Check if some modules are already active (like for example when the plugin was previously active on the site).
  2. Check if the plugin is connected to WordPress.com.

If so, we'll want to run the feature activation routines to ensure the module is correctly set up.

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

  • N/A

Does this pull request change what data or activity we track or use?

  • No

Testing instructions:

  • When the Jetpack Boost plugin is active, activate the cache module.
  • Check that an advanced-cache.php file was created in wp-content.
  • Now go to the Plugins menu and deactivate the plugin.
  • You will see the file gets deleted.
  • Now activate the plugin again.
  • The file will be created again.

Fixes #41718

When the plugin is activated:

1. Check if some modules are already active (like for example when the plugin was previously active on the site).
2. Check if the plugin is connected to WordPress.com.

If so, we'll want to run the feature activation routines to ensure the module is correctly set up.
@jeherve jeherve added Bug When a feature is broken and / or not performing as intended General [Status] In Progress labels Apr 21, 2025
@jeherve jeherve requested a review from a team April 21, 2025 15:51
@jeherve jeherve self-assigned this Apr 21, 2025
@github-actions github-actions bot added the [Plugin] Boost A feature to speed up the site and improve performance. label Apr 21, 2025
@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 21, 2025

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 Review, ...).
  • ✅ Add a "[Type]" label (Bug, Enhancement, Janitorial, Task).
  • ✅ 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 🤖


Follow this PR Review Process:

  1. Ensure all required checks appearing at the bottom of this PR are passing.
  2. Make sure to test your changes on all platforms that it applies to. You're responsible for the quality of the code you ship.
  3. You can use GitHub's Reviewers functionality to request a review.
  4. When it's reviewed and merged, you will be pinged in Slack to deploy the changes to WordPress.com simple once the build is done.

If you have questions about anything, reach out in #jetpack-developers for guidance!


Boost plugin:

  • Next scheduled release: April 30, 2025

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

@jp-launch-control
Copy link
Copy Markdown

jp-launch-control bot commented Apr 21, 2025

Code Coverage Summary

Coverage changed in 1 file.

File Coverage Δ% Δ Uncovered
projects/plugins/boost/app/class-jetpack-boost.php 0/108 (0.00%) 0.00% 6 💔

Full summary · PHP report · JS report

Coverage check overridden by I don't care about code coverage for this PR Use this label to ignore the check for insufficient code coveage. .

haqadn
haqadn previously requested changes Apr 21, 2025
* Check what modules are already active (from a previous activation for example).
* If there are active modules, we need to ensure each module-related event is triggered again.
*/
$active_modules = $modules_setup->get_ready_active_optimization_modules();
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

get_ready_active_optimization_modules might not be the right list. The ready check will exclude all the modules that are currently not ready. For example, cloud CSS is not ready until it's generated, but it should be activated to generate the critical CSS in the first place and become ready.

So, in this case, we want to get all modules with the active state and run the routine on them.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the pointer! I updated the PR to try to address that.

@jeherve jeherve force-pushed the update/boost-reactivate-setup branch from be354f2 to ccdb215 Compare April 21, 2025 16:29
@jeherve jeherve added [Status] Needs Review This PR is ready for review. I don't care about code coverage for this PR Use this label to ignore the check for insufficient code coveage. and removed [Status] In Progress labels Apr 21, 2025
Copy link
Copy Markdown
Member

@dilirity dilirity left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice and clean! Thanks for taking care of this.

:shipit:

@jeherve jeherve dismissed haqadn’s stale review April 22, 2025 15:31

Changes were addressed

@jeherve jeherve merged commit c06429b into trunk Apr 22, 2025
68 of 70 checks passed
@jeherve jeherve deleted the update/boost-reactivate-setup branch April 22, 2025 15:31
@github-actions github-actions bot removed the [Status] Needs Review This PR is ready for review. label Apr 22, 2025
@github-actions github-actions bot added this to the boost/3.14.0 milestone Apr 22, 2025
matticbot pushed a commit to Automattic/jetpack-storybook that referenced this pull request Apr 22, 2025
* Boost: run module status change routine on plugin activation

Fixes #41718

When the plugin is activated:

1. Check if some modules are already active (like for example when the plugin was previously active on the site).
2. Check if the plugin is connected to WordPress.com.

If so, we'll want to run the feature activation routines to ensure the module is correctly set up.

* Switch method to get active modules

See Automattic/jetpack#43168 (review)

Committed via a GitHub action: https://github.com/Automattic/jetpack/actions/runs/14598715531

Upstream-Ref: Automattic/jetpack@c06429b
matticbot pushed a commit to Automattic/jetpack-boost-production that referenced this pull request Apr 22, 2025
* Boost: run module status change routine on plugin activation

Fixes #41718

When the plugin is activated:

1. Check if some modules are already active (like for example when the plugin was previously active on the site).
2. Check if the plugin is connected to WordPress.com.

If so, we'll want to run the feature activation routines to ensure the module is correctly set up.

* Switch method to get active modules

See Automattic/jetpack#43168 (review)

Committed via a GitHub action: https://github.com/Automattic/jetpack/actions/runs/14598715531

Upstream-Ref: Automattic/jetpack@c06429b
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Bug When a feature is broken and / or not performing as intended General I don't care about code coverage for this PR Use this label to ignore the check for insufficient code coveage. [Plugin] Boost A feature to speed up the site and improve performance.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Boost: Re-activating the plugin doesn't run modules activation

3 participants