Skip to content

Add features that allow restriction of the number of wpcom plugins per plan to wpsh #43108

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

Open
wants to merge 5 commits into
base: trunk
Choose a base branch
from

Conversation

dzver
Copy link
Member

@dzver dzver commented Apr 16, 2025

This change is not fine to be merged without @claudiucelfilip's work on conditionally enabling plugins on a couple of other plans. It will work but is not easily testable.

Proposed changes:

  • Provides two new features that will restrict the number of non-default plugins to 1 or 3

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:

This is a WPCOMSH change for WPCOM atomic sites. It's only meant to be tested from wp-admin, the Calypso part will come separately.

  • Using a Business plan dev blog on WPCOM
  • Modify wpcom-features - PLUGINS_ALLOW_ONE or THREE to include self::WPCOM_BUSINESS_PLANS
  • Install 1 or 3 plugins
Screenshot 2025-04-16 at 17 16 01 Screenshot 2025-04-16 at 17 15 39
  • Removing the plugin_action_links will allow you to attempt activating plugins beyond the limit. This should also not work, although without an error as I couldn't find a hook that would handle wp_error properly

Copy link
Contributor

github-actions bot commented Apr 16, 2025

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 WoA dev 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 (WordPress.com Site Helper), and enable the update/add-plugins-one-and-three-features branch.

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

Copy link
Contributor

github-actions bot commented Apr 16, 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!


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.

@github-actions github-actions bot added the [Status] Needs Author Reply We need more details from you. This label will be auto-added until the PR meets all requirements. label Apr 16, 2025
Copy link

jp-launch-control bot commented Apr 16, 2025

Code Coverage Summary

Coverage changed in 3 files.

File Coverage Δ% Δ Uncovered
projects/plugins/wpcomsh/feature-plugins/hooks.php 24/166 (14.46%) -2.44% 24 💔
projects/plugins/wpcomsh/functions.php 9/157 (5.73%) -0.84% 20 💔
projects/plugins/wpcomsh/constants.php 0/31 (0.00%) 0.00% 14 💔

Full summary · PHP report

If appropriate, add one of these labels to override the failing coverage check: Covered by non-unit tests Use to ignore the Code coverage requirement check when E2Es or other non-unit tests cover the code Coverage tests to be added later Use to ignore the Code coverage requirement check when tests will be added in a follow-up PR I don't care about code coverage for this PR Use this label to ignore the check for insufficient code coveage.

@@ -33,3 +33,18 @@

// Date for lowering storage from 200 GB to 50 GB for business and higher plans. Ref: D108151-code.
define( 'LEGACY_200GB_CUTOFF_DATE', '2023-07-20' );

define(
Copy link
Member Author

Choose a reason for hiding this comment

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

I'm not sure this is the right way, I'll look into it tomorrow and see if I can come up with another way for identifying the default plugins.

Copy link
Member Author

Choose a reason for hiding this comment

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

I couldn't find a better way, maybe one will surface during code review. There's a list of woa-specific jetpack plugins that have their activation/deactivation altered but it doesn't include things like the ones here. I'm leaving it as is.

return $new_value;
}

// Plugins are manually activated one by one
Copy link
Member Author

Choose a reason for hiding this comment

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

I'll need to see how plugins are activated during provisioning to make sure this code doesn't interfere.

@dzver dzver added [Status] In Progress [Type] Task and removed [Status] Needs Author Reply We need more details from you. This label will be auto-added until the PR meets all requirements. labels Apr 18, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant