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

Add the vip feature flag, analytics flag and bump plugin version #732

Merged
merged 11 commits into from
Jun 25, 2024

Conversation

ingeniumed
Copy link
Contributor

Description

  • Add the vip feature flag, as well as the analytics flag. These don't do anything right now, but they have helper methods tied to them at the module level so it's easy to see if its enabled or not. In addition, this is set to on by default if its a VIP site. It's shown on the settings page itself.
  • Bump up the plugin version to 0.10.0 so that we can properly mark the since fields.
  • Remove timesince because it's not used and it's not really do proper GMT calculations. The old code that it used to be used for has been replaced by human_time which is way simpler. Didn't really think marking this as deprecated and pointing to that is better. We will encounter more cases like this and we can make a call case by case.
  • Lots of PHPCS fixes related to escaping the output, and disabling the nonce for the settings controller rendering.

Steps to Test

  • Play around with the settings for vip_features and analytics to make sure it's okay.
  • Everything else should be unaffected

@ingeniumed ingeniumed self-assigned this Jun 24, 2024
Comment on lines 82 to 84
return defined( 'WPCOM_IS_VIP_ENV' ) && constant( 'WPCOM_IS_VIP_ENV' ) === true
&& defined( 'WPCOM_SANDBOXED' ) && constant( 'WPCOM_SANDBOXED' ) === false
&& defined( 'FILES_CLIENT_SITE_ID' );
Copy link
Contributor

@alecgeatches alecgeatches Jun 24, 2024

Choose a reason for hiding this comment

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

@ingeniumed I noticed in vip dev-env that WPCOM_IS_VIP_ENV is false, it seems like it's only set to true on production sites. Can we change this to use the presence of VIP_GO_ENV instead? The valid values for this seem to be "production" and "local", but I think just checking that it exists will do the trick:

Suggested change
return defined( 'WPCOM_IS_VIP_ENV' ) && constant( 'WPCOM_IS_VIP_ENV' ) === true
&& defined( 'WPCOM_SANDBOXED' ) && constant( 'WPCOM_SANDBOXED' ) === false
&& defined( 'FILES_CLIENT_SITE_ID' );
return defined( 'VIP_GO_ENV' )
&& defined( 'WPCOM_SANDBOXED' ) && constant( 'WPCOM_SANDBOXED' ) === false
&& defined( 'FILES_CLIENT_SITE_ID' );

Note that this is different than the logic we used in the block data API, and that's mostly because we didn't want to send analytics locally. However, I think we should have the "Turn on WordPress VIP features" default to true on vip dev-env.

That probably means we'll want two VIP-related checks, one for analytics (exclude local environments), and one for VIP features (local environments are fine).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good catch, corrected this in this commit by allowing for a flag to be passed in that will ensure only production sites are considered wpvip sites.

Copy link
Contributor

@alecgeatches alecgeatches left a comment

Choose a reason for hiding this comment

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

Left one small comment about VIP detection for vip dev-env, and I also see there are some PHPCS errors from the tests. Other than that, looks good to me! Glad we're getting a lot of the PHPCS formatting out of the way, because it's a lot to review and GitHub's diffing is not equipped to review this many file changes.

@ingeniumed
Copy link
Contributor Author

Left one small comment about VIP detection for vip dev-env, and I also see there are some PHPCS errors from the tests. Other than that, looks good to me! Glad we're getting a lot of the PHPCS formatting out of the way, because it's a lot to review and GitHub's diffing is not equipped to review this many file changes.

I ended up disabling that script for now. I figured once we lint the entire codebase we can renable it just so we don't keep getting failures. It makes sense it would fail though because linting custom status causes aboutg 1500 lines to change and that can be pushed off to another PR

@ingeniumed ingeniumed merged commit 6fb514d into develop Jun 25, 2024
2 of 3 checks passed
@ingeniumed ingeniumed deleted the add/vip-feature-flag branch June 25, 2024 01:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants