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

Display EP and ES versions #43

Merged
merged 2 commits into from
Jul 20, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 32 additions & 1 deletion debug-bar-elasticpress.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,40 @@ function ep_add_debug_bar_panel( $panels ) {
$panels[] = new EP_Debug_Bar_ElasticPress();
return $panels;
}

add_filter( 'debug_bar_panels', 'ep_add_debug_bar_panel' );

/**
* Register status
*
* @param array $stati Debug Bar Stati
* @return array
*/
function ep_add_debug_bar_stati( $stati ) {
$stati[] = array(
'ep_version',
esc_html__( 'ElasticPress Version', 'debug-bar-elasticpress' ),
defined( 'EP_VERSION' ) ? EP_VERSION : '',
);

$elasticsearch_version = '';
if (
class_exists( '\ElasticPress\Elasticsearch' ) &&
method_exists( \ElasticPress\Elasticsearch::factory(), 'get_elasticsearch_version' )
) {
$elasticsearch_version = \ElasticPress\Elasticsearch::factory()->get_elasticsearch_version();
}
if ( function_exists( '\ElasticPress\Utils\is_epio' ) && \ElasticPress\Utils\is_epio() ) {
$elasticsearch_version = esc_html__( 'ElasticPress.io Managed Platform', 'debug-bar-elasticpress' );
}
$stati[] = array(
'es_version',
esc_html__( 'Elasticsearch Version', 'debug-bar-elasticpress' ),
$elasticsearch_version,
);
return $stati;
}
add_filter( 'debug_bar_statuses', 'ep_add_debug_bar_stati' );

/**
* Add explain=true to elastic post query
*
Expand Down