jetpack
jetpack copied to clipboard
WPCOMSH: Post transfer action to conditionally enable HPOS on WooCommerce sites
Related to 1468
Proposed changes:
Along with D153524-code, this adds a more general fix for the issue where some WooCommerce sites did not have HPOS enabled after the Atomic transfer.
This adds a new post-transfer action which checks to see if HPOS needs to be enabled for the site and enables it.
Other information:
- [NA] Have you written new tests for your changes, if applicable?
- [x] Have you checked the E2E test CI results, and verified that your changes do not break them?
- [x] 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:
Note that we can't do a complete end-to-end test until this PR and the corresponding WPCOM diff (D153524) have been deployed. Once these both ship, the functionality will be gated to Serenity users and we can do a full test and remove the gate.
Setup
- Go to https://wordpress.com/setup/free and create a new site.
- Continue through the site flow. It doesn't matter if you launch the site or not.
- Locate the site id and add the site as an Atomic dev blog (transfer to Atomic dev server pool).
- Go to the site dashboard and upgrade to an Entrepreneur plan.
- Go to the Hosting Config (
https://wordpress.com/hosting-config/yourtestsite.wpcomstaging.com
) and ensure that ssh is enabled. - SSH into your site and check to see if HPOS is enabled (
wp wc hpos status
). If it's enabled, disable it by runningwp wc hpos disable
.
Testing
- Apply D153524-code to your sandbox and sandbox the public-api.
- Check out this branch (
1468-update/hpos-wpcomsh-wpcli
) to the Jetpack project on your local machine. - From within the Jetpack project run
jetpack rsync wpcomsh [email protected]:htdocs/wp-content/mu-plugins
(replace yourtestsite with the actual name of your test site) to copy the wpcomsh changes to your WoA site. - SSH into your site and run
wp shell
. - In the wp shell, run
do_action( 'wpcomsh_woa_post_transfer', array(), array( 'woocommerce_hpos' => true ) );
. - Verify that the command runs without errors.
- Use
CTRL-D
to exit the wp shell (this ensures PHP shutdown runs and we send the appropriate messages to logstash. - Run
wp wc hops status
and verify that HPOS is now enabled. - Go to logstash (d15a40a7e6287357551d44cc5a806099-logstash) and verify that you see a success message for your blog id.