Yoast\WP\SEO\MyYoast_Client\User_Interface

Auth_Command::statuspublicYoast 1.0

Shows the current MyYoast OAuth client status.

Displays issuer configuration, registration state, and token status without making any network calls. Use the global --user flag to check a specific user's token status.

OPTIONS

[--format=<format>]
Output format.
--- default: table options:
  • table
  • json

EXAMPLES

wp yoast auth status
wp yoast auth status --user=admin
wp yoast auth status --format=json

Метод класса: Auth_Command{}

Хуков нет.

Возвращает

null. Ничего (null).

Использование

$Auth_Command = new Auth_Command();
$Auth_Command->status( $args, $assoc_args ): void;
$args
.
По умолчанию: null
$assoc_args
.
По умолчанию: null

Код Auth_Command::status() Yoast 27.7

public function status( $args = null, $assoc_args = null ): void {
	$user_id = \get_current_user_id();

	$issuer_url        = $this->issuer_config->get_issuer_url();
	$has_software      = ( $this->issuer_config->get_software_statement() !== '' );
	$has_iat           = ( $this->issuer_config->get_initial_access_token() !== '' );
	$is_registered     = $this->myyoast_client->is_registered();
	$client_id         = null;
	$registered_client = $this->client_registration->get_registered_client();

	if ( $registered_client !== null ) {
		$client_id = $registered_client->get_client_id();
	}

	$site_token      = $this->token_storage->get();
	$site_token_info = $this->build_token_info( $site_token );

	$user_token      = ( $user_id > 0 ) ? $this->user_token_storage->get( $user_id ) : null;
	$user_token_info = $this->build_token_info( $user_token );

	$data = [
		'issuer_url'           => $issuer_url,
		'software_statement'   => ( $has_software ) ? 'configured' : 'not configured',
		'initial_access_token' => ( $has_iat ) ? 'configured' : 'not configured',
		'registered'           => ( $is_registered ) ? 'yes' : 'no',
		'client_id'            => ( $client_id ?? '-' ),
		'site_token'           => $site_token_info['status'],
		'site_token_expires'   => $site_token_info['expires'],
		'site_token_scopes'    => $site_token_info['scopes'],
		'user_id'              => ( $user_id > 0 ) ? $user_id : 'none (use --user flag)',
		'user_token'           => $user_token_info['status'],
		'user_token_expires'   => $user_token_info['expires'],
		'user_token_scopes'    => $user_token_info['scopes'],
		'user_token_errors'    => $user_token_info['error_count'],
	];

	$this->output( $data, $assoc_args['format'] );
}