WC_Tracker::get_wordpress_info
Get WordPress related data.
Метод класса: WC_Tracker{}
Хуков нет.
Возвращает
array.
Использование
$result = WC_Tracker::get_wordpress_info();
Код WC_Tracker::get_wordpress_info() WC Tracker::get wordpress info WC 11.3.0
private static function get_wordpress_info() {
$wp_data = array();
$memory = wp_convert_hr_to_bytes( WP_MEMORY_LIMIT );
if ( function_exists( 'memory_get_usage' ) ) {
// phpcs:ignore WordPress.PHP.NoSilencedErrors.Discouraged -- False positive.
$system_memory = @wc_get_container()->get( LegacyProxy::class )->call_function( 'ini_get', 'memory_limit' );
// Use 32G for no limit (-1), matching the system status REST API.
$memory = max( $memory, wp_convert_hr_to_bytes( '-1' === $system_memory ? '32G' : $system_memory ) );
}
// WordPress 5.5+ environment type specification.
// 'production' is the default in WP, thus using it as a default here, too.
$environment_type = 'production';
if ( function_exists( 'wp_get_environment_type' ) ) {
$environment_type = wp_get_environment_type();
}
$wp_data['memory_limit'] = size_format( $memory );
$wp_data['debug_mode'] = ( defined( 'WP_DEBUG' ) && WP_DEBUG ) ? 'Yes' : 'No';
$wp_data['locale'] = get_locale();
$wp_data['version'] = get_bloginfo( 'version' );
$wp_data['multisite'] = is_multisite() ? 'Yes' : 'No';
$wp_data['env_type'] = $environment_type;
$wp_data['dropins'] = array_keys( get_dropins() );
return $wp_data;
}