Skip to content

Commit

Permalink
Correct the vip site detection check to work for vip dev-env as well
Browse files Browse the repository at this point in the history
  • Loading branch information
ingeniumed committed Jun 25, 2024
1 parent 7ac72d3 commit 60f04b0
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 5 deletions.
16 changes: 12 additions & 4 deletions common/php/class-module.php
Original file line number Diff line number Diff line change
Expand Up @@ -76,12 +76,20 @@ protected function is_analytics_enabled() {
* Check if the site is a WPVIP site.
*
* @since 0.10.0
*
* @param bool $only_production Whether to only allow production sites to be considered WPVIP sites
* @return true, if it is a WPVIP site, false otherwise
*/
protected function is_vip_site() {
return defined( 'WPCOM_IS_VIP_ENV' ) && constant( 'WPCOM_IS_VIP_ENV' ) === true
&& defined( 'WPCOM_SANDBOXED' ) && constant( 'WPCOM_SANDBOXED' ) === false
&& defined( 'FILES_CLIENT_SITE_ID' );
protected function is_vip_site( $only_production = false ) {
$is_vip_site = defined( 'VIP_GO_ENV' )
&& defined( 'WPCOM_SANDBOXED' ) && constant( 'WPCOM_SANDBOXED' ) === false
&& defined( 'FILES_CLIENT_SITE_ID' );

if ( $only_production ) {
$is_vip_site = $is_vip_site && defined( 'VIP_GO_ENV' ) && 'production' === constant( 'VIP_GO_ENV' );
}

return $is_vip_site;
}

/**
Expand Down
2 changes: 1 addition & 1 deletion modules/settings/settings.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public function __construct() {
'default_options' => array(
'enabled' => 'on',
'vip_features' => $this->is_vip_site() ? 'on' : 'off',
'analytics' => $this->is_vip_site() ? 'on' : 'off',
'analytics' => $this->is_vip_site( true ) ? 'on' : 'off',
),
'configure_page_cb' => 'print_default_settings',
'autoload' => true,
Expand Down

0 comments on commit 60f04b0

Please sign in to comment.