wpseek.com
Eine auf WordPress spezialiserte Suchmaschine für Entwickler und Theme-Autoren



wp_secrets_site_health_debug_info › WordPress Function

Seit7.2.0
Veraltetn/v
› wp_secrets_site_health_debug_info ( $info )
Parameter:
  • (array<string,array<string,mixed>>) $info Existing debug information sections.
    Erforderlich: Ja
Gibt zurück:
  • (array<string,array<string,mixed>>)
Definiert in:
Codex:

Adds a Secrets API section to Site Health's debug information.

Counts and class names only – no secret values, and no fingerprints. Network scope figures are included only for a super admin on a multisite install.


Quellcode

function wp_secrets_site_health_debug_info( $info ) {
	$key_manager = _wp_secrets_get_key_manager();
	$provider    = _wp_secrets_get_provider();

	$fields = array(
		'dropin_active'  => array(
			'label' => __( 'Drop-in active' ),
			'value' => wp_using_secrets_dropin() ? __( 'Yes' ) : __( 'No' ),
		),
		'provider_class' => array(
			'label' => __( 'Provider class' ),
			'value' => get_class( $provider ),
		),
		'protected_by'   => array(
			'label' => __( 'Secrets protected by' ),
			'value' => $provider->get_label(),
		),
		'protection_at'  => array(
			'label' => __( 'Encryption boundary' ),
			'value' => WP_Secrets_Provider::BOUNDARY_WORDPRESS === $provider->get_protection_boundary()
				? __( 'WordPress' )
				: __( 'The provider (outside WordPress)' ),
		),
		'writable'       => array(
			'label' => __( 'Accepts writes' ),
			'value' => $provider->is_writable() ? __( 'Yes' ) : __( 'No' ),
		),
		'keyring_class'  => array(
			'label' => __( 'Keyring class' ),
			'value' => get_class( $key_manager->get_keyring() ),
		),
		'key_source'     => array(
			'label' => __( 'Key source' ),
			'value' => $key_manager->get_keyring()->get_key_source(),
		),
		'record_version' => array(
			'label' => __( 'Record format version' ),
			'value' => (string) WP_SECRETS_RECORD_VERSION,
		),
	);

	$site_secrets                = wp_list_secrets();
	$fields['site_secret_count'] = array(
		'label' => __( 'Site secrets' ),
		'value' => is_wp_error( $site_secrets ) ? __( 'Unavailable' ) : (string) count( $site_secrets ),
	);

	if ( is_multisite() && is_super_admin() ) {
		$network_secrets                = wp_list_network_secrets();
		$fields['network_secret_count'] = array(
			'label' => __( 'Network secrets' ),
			'value' => is_wp_error( $network_secrets ) ? __( 'Unavailable' ) : (string) count( $network_secrets ),
		);
	}

	$info['secrets-api'] = array(
		'label'  => __( 'Secrets API' ),
		'fields' => $fields,
	);

	return $info;
}