Skip to content

Commit

Permalink
Add VIP_SEARCH_ENABLED_BY (#6082)
Browse files Browse the repository at this point in the history
* Add new constant VIP_SEARCH_ENABLED_BY

* Add to SDS for tracking

* Move up

* lint
  • Loading branch information
rebeccahum committed Jan 8, 2025
1 parent 2121e08 commit 69ac9e2
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 0 deletions.
3 changes: 3 additions & 0 deletions 000-vip-init.php
Original file line number Diff line number Diff line change
Expand Up @@ -280,6 +280,9 @@
if ( ( defined( 'USE_VIP_ELASTICSEARCH' ) && USE_VIP_ELASTICSEARCH ) || // legacy constant name
( defined( 'VIP_ENABLE_VIP_SEARCH' ) && true === VIP_ENABLE_VIP_SEARCH ) ) {
require_once __DIR__ . '/search/search.php';
if ( ! defined( 'VIP_SEARCH_ENABLED_BY' ) ) {
define( 'VIP_SEARCH_ENABLED_BY', 'constant' );
}
}

// Set WordPress environment type
Expand Down
2 changes: 2 additions & 0 deletions config/class-site-details-index.php
Original file line number Diff line number Diff line change
Expand Up @@ -260,10 +260,12 @@ public function get_search_info() {
$search_info['enabled'] = true;
$search_info['query_integration_enabled'] = \Automattic\VIP\Search\Search::is_query_integration_enabled();
$search_info['network_enabled'] = defined( 'EP_IS_NETWORK' ) && true === constant( 'EP_IS_NETWORK' );
$search_info['enabled_by'] = defined( 'VIP_SEARCH_ENABLED_BY' ) ? constant( 'VIP_SEARCH_ENABLED_BY' ) : 'unknown';
} else {
$search_info['enabled'] = false;
$search_info['query_integration_enabled'] = false;
$search_info['network_enabled'] = false;
$search_info['enabled_by'] = false;
}

return $search_info;
Expand Down
4 changes: 4 additions & 0 deletions integrations/enterprise-search.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,10 @@ public function load(): void {
} else {
require_once __DIR__ . '/../search/search.php';
}

if ( ! defined( 'VIP_SEARCH_ENABLED_BY' ) ) {
define( 'VIP_SEARCH_ENABLED_BY', 'integration' );
}
}

/**
Expand Down

0 comments on commit 69ac9e2

Please sign in to comment.