| Server IP : 35.201.19.92 / Your IP : 216.73.217.65 Web Server : nginx System : Linux pod-200961 6.8.0-1055-gke #61-Ubuntu SMP Tue May 26 22:57:42 UTC 2026 x86_64 User : fpm200098 ( 200098) PHP Version : 8.2.33 Disable Function : apache_child_terminate,apache_get_modules,apache_get_version,apache_getenv,apache_note,apache_setenv,disk_free_space,disk_total_space,diskfreespace,dl,exec,fastcgi_finish_request,link,opcache_compile_file,opcache_get_configuration,opcache_invalidate,opcache_is_script_cached,opcache_reset,passthru,pclose,pcntl_exec,popen,posix_getpid,posix_getppid,posix_getpwuid,posix_kill,posix_mkfifo,posix_setegid,posix_seteuid,posix_setgid,posix_setpgid,posix_setsid,posix_setuid,posix_uname,proc_close,proc_get_status,proc_nice,proc_open,proc_terminate,realpath_cache_get,shell_exec,show_source,symlink,system MySQL : OFF | cURL : ON | WGET : OFF | Perl : ON | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : /nas/content/live/questfamilyday/wp-content/mu-plugins/wpengine-common/ |
Upload File : |
<?php
/** Functions relating to site health data storage for use in the go live checklist.
*
* @package wpengine/common-mu-plugin
*/
if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly.
}
/**
* A filter that stores the site health check results in the database for access by the go live checklist.
* It is necessary to store it in this fashion as it is set as a transient by default, which is not guaranteed
* to be saved in the database.
*
* @param string $value the value of the transient being saved.
* @return string the unchanged value of the transient.
*/
function store_site_health_results_in_db( $value ) {
update_option( 'wpe-health-check-site-status-result', $value );
return $value;
}
add_filter( 'pre_set_transient_health-check-site-status-result', 'store_site_health_results_in_db' );
/**
* A filter to add communication checks with WP Engine's WordPress API.
* Adding both two tests, one for standard WordPress methods of external communication, and one for direct comms
* via PHP function which will allow support to see if theme or plugin code is affecting the ability to communicate.
*
* @return array an array of additional fields which get merged into the WP Core site health fields.
*/
function wpe_get_site_health_api_fields() {
$return = array();
$wp_result = wp_remote_get( 'https://wpe-api.wpengine.com', array( 'timeout' => 5 ) );
if ( is_wp_error( $wp_result ) ) {
$result_string = 'Unable to communicate with the WP Engine WordPress API.';
$debug = 'WP_Error';
} elseif ( ! is_array( $wp_result ) || '{}' !== $wp_result['body'] ) {
$result_string = 'An unexpected result was returned from the WP Engine WordPress API.';
$debug = ! empty( $wp_result['body'] ) && is_string( $wp_result['body'] ) ? $wp_result['body'] : 'false';
} else {
$result_string = 'The WP Engine WordPress API is reachable.';
$debug = true;
}
$return['wpengine_api'] = array(
'label' => 'Communication with the WP Engine WordPress API',
'value' => $result_string,
'debug' => $debug,
);
$opts = array(
'http' => array(
'timeout' => 60,
),
);
$context = stream_context_create( $opts );
/**
* WPE API Direct Check
*
* An extra non-filterable connection check to our API, some plugins (especially those modified to remove licensing code)
* break our API code, so this check is designed to see if there is a local WP issue causing problems.
*/
// phpcs:ignore -- we need to use file_get_contents here to test the direct connection.
$raw_result = @file_get_contents( 'https://wpe-api.wpengine.com', false, $context );
if ( is_wp_error( $raw_result ) || false === $raw_result ) {
$result_string = 'Unable to communicate with the WP Engine WordPress API Directly.';
} elseif ( '{}' !== $raw_result ) {
$result_string = 'An unexpected result was returned from the WP Engine WordPress API Directly.';
} else {
$result_string = 'The WP Engine WordPress API is reachable directly.';
}
$return['wpengine_api_direct'] = array(
'label' => 'Communication with the WP Engine WordPress API (Direct)',
'value' => $result_string,
'debug' => is_string( $wp_result ) ? $wp_result : false,
);
return $return;
}
add_filter(
'debug_information',
function ( $info ) {
$info['wp-core']['fields'] = array_merge( $info['wp-core']['fields'], wpe_get_site_health_api_fields() );
return $info;
}
);