$66 GRAYBYTE WORDPRESS FILE MANAGER $11

SERVER : premium201.web-hosting.com #1 SMP Wed Mar 26 12:08:09 UTC 2025
SERVER IP : 172.67.217.254 | ADMIN IP 216.73.216.180
OPTIONS : CRL = ON | WGT = ON | SDO = OFF | PKEX = OFF
DEACTIVATED : mail

/home/bravrvjk/ubukode.com/wp-includes/rest-api/endpoints/

HOME
Current File : /home/bravrvjk/ubukode.com/wp-includes/rest-api/endpoints//class-wp-rest-site-health-controller.php
<?php
/**
 * REST API: WP_REST_Site_Health_Controller class
 *
 * @package WordPress
 * @subpackage REST_API
 * @since 5.6.0
 */

/**
 * Core class for interacting with Site Health tests.
 *
 * @since 5.6.0
 *
 * @see WP_REST_Controller
 */
class WP_REST_Site_Health_Controller extends WP_REST_Controller {

	/**
	 * An instance of the site health class.
	 *
	 * @since 5.6.0
	 *
	 * @var WP_Site_Health
	 */
	private $site_health;

	/**
	 * Site Health controller constructor.
	 *
	 * @since 5.6.0
	 *
	 * @param WP_Site_Health $site_health An instance of the site health class.
	 */
	public function __construct( $site_health ) {
		$this->namespace = 'wp-site-health/v1';
		$this->rest_base = 'tests';

		$this->site_health = $site_health;
	}

	/**
	 * Registers API routes.
	 *
	 * @since 5.6.0
	 * @since 6.1.0 Adds page-cache async test.
	 *
	 * @see register_rest_route()
	 */
	public function register_routes() {
		register_rest_route(
			$this->namespace,
			sprintf(
				'/%s/%s',
				$this->rest_base,
				'background-updates'
			),
			array(
				array(
					'methods'             => 'GET',
					'callback'            => array( $this, 'test_background_updates' ),
					'permission_callback' => function () {
						return $this->validate_request_permission( 'background_updates' );
					},
				),
				'schema' => array( $this, 'get_public_item_schema' ),
			)
		);

		register_rest_route(
			$this->namespace,
			sprintf(
				'/%s/%s',
				$this->rest_base,
				'loopback-requests'
			),
			array(
				array(
					'methods'             => 'GET',
					'callback'            => array( $this, 'test_loopback_requests' ),
					'permission_callback' => function () {
						return $this->validate_request_permission( 'loopback_requests' );
					},
				),
				'schema' => array( $this, 'get_public_item_schema' ),
			)
		);

		register_rest_route(
			$this->namespace,
			sprintf(
				'/%s/%s',
				$this->rest_base,
				'https-status'
			),
			array(
				array(
					'methods'             => 'GET',
					'callback'            => array( $this, 'test_https_status' ),
					'permission_callback' => function () {
						return $this->validate_request_permission( 'https_status' );
					},
				),
				'schema' => array( $this, 'get_public_item_schema' ),
			)
		);

		register_rest_route(
			$this->namespace,
			sprintf(
				'/%s/%s',
				$this->rest_base,
				'dotorg-communication'
			),
			array(
				array(
					'methods'             => 'GET',
					'callback'            => array( $this, 'test_dotorg_communication' ),
					'permission_callback' => function () {
						return $this->validate_request_permission( 'dotorg_communication' );
					},
				),
				'schema' => array( $this, 'get_public_item_schema' ),
			)
		);

		register_rest_route(
			$this->namespace,
			sprintf(
				'/%s/%s',
				$this->rest_base,
				'authorization-header'
			),
			array(
				array(
					'methods'             => 'GET',
					'callback'            => array( $this, 'test_authorization_header' ),
					'permission_callback' => function () {
						return $this->validate_request_permission( 'authorization_header' );
					},
				),
				'schema' => array( $this, 'get_public_item_schema' ),
			)
		);

		register_rest_route(
			$this->namespace,
			sprintf(
				'/%s',
				'directory-sizes'
			),
			array(
				'methods'             => 'GET',
				'callback'            => array( $this, 'get_directory_sizes' ),
				'permission_callback' => function () {
					return $this->validate_request_permission( 'directory_sizes' ) && ! is_multisite();
				},
			)
		);

		register_rest_route(
			$this->namespace,
			sprintf(
				'/%s/%s',
				$this->rest_base,
				'page-cache'
			),
			array(
				array(
					'methods'             => 'GET',
					'callback'            => array( $this, 'test_page_cache' ),
					'permission_callback' => function () {
						return $this->validate_request_permission( 'page_cache' );
					},
				),
			)
		);
	}

	/**
	 * Validates if the current user can request this REST endpoint.
	 *
	 * @since 5.6.0
	 *
	 * @param string $check The endpoint check being ran.
	 * @return bool
	 */
	protected function validate_request_permission( $check ) {
		$default_capability = 'view_site_health_checks';

		/**
		 * Filters the capability needed to run a given Site Health check.
		 *
		 * @since 5.6.0
		 *
		 * @param string $default_capability The default capability required for this check.
		 * @param string $check              The Site Health check being performed.
		 */
		$capability = apply_filters( "site_health_test_rest_capability_{$check}", $default_capability, $check );

		return current_user_can( $capability );
	}

	/**
	 * Checks if background updates work as expected.
	 *
	 * @since 5.6.0
	 *
	 * @return array
	 */
	public function test_background_updates() {
		$this->load_admin_textdomain();
		return $this->site_health->get_test_background_updates();
	}

	/**
	 * Checks that the site can reach the WordPress.org API.
	 *
	 * @since 5.6.0
	 *
	 * @return array
	 */
	public function test_dotorg_communication() {
		$this->load_admin_textdomain();
		return $this->site_health->get_test_dotorg_communication();
	}

	/**
	 * Checks that loopbacks can be performed.
	 *
	 * @since 5.6.0
	 *
	 * @return array
	 */
	public function test_loopback_requests() {
		$this->load_admin_textdomain();
		return $this->site_health->get_test_loopback_requests();
	}

	/**
	 * Checks that the site's frontend can be accessed over HTTPS.
	 *
	 * @since 5.7.0
	 *
	 * @return array
	 */
	public function test_https_status() {
		$this->load_admin_textdomain();
		return $this->site_health->get_test_https_status();
	}

	/**
	 * Checks that the authorization header is valid.
	 *
	 * @since 5.6.0
	 *
	 * @return array
	 */
	public function test_authorization_header() {
		$this->load_admin_textdomain();
		return $this->site_health->get_test_authorization_header();
	}

	/**
	 * Checks that full page cache is active.
	 *
	 * @since 6.1.0
	 *
	 * @return array The test result.
	 */
	public function test_page_cache() {
		$this->load_admin_textdomain();
		return $this->site_health->get_test_page_cache();
	}

	/**
	 * Gets the current directory sizes for this install.
	 *
	 * @since 5.6.0
	 *
	 * @return array|WP_Error
	 */
	public function get_directory_sizes() {
		if ( ! class_exists( 'WP_Debug_Data' ) ) {
			require_once ABSPATH . 'wp-admin/includes/class-wp-debug-data.php';
		}

		$this->load_admin_textdomain();

		$sizes_data = WP_Debug_Data::get_sizes();
		$all_sizes  = array( 'raw' => 0 );

		foreach ( $sizes_data as $name => $value ) {
			$name = sanitize_text_field( $name );
			$data = array();

			if ( isset( $value['size'] ) ) {
				if ( is_string( $value['size'] ) ) {
					$data['size'] = sanitize_text_field( $value['size'] );
				} else {
					$data['size'] = (int) $value['size'];
				}
			}

			if ( isset( $value['debug'] ) ) {
				if ( is_string( $value['debug'] ) ) {
					$data['debug'] = sanitize_text_field( $value['debug'] );
				} else {
					$data['debug'] = (int) $value['debug'];
				}
			}

			if ( ! empty( $value['raw'] ) ) {
				$data['raw'] = (int) $value['raw'];
			}

			$all_sizes[ $name ] = $data;
		}

		if ( isset( $all_sizes['total_size']['debug'] ) && 'not available' === $all_sizes['total_size']['debug'] ) {
			return new WP_Error( 'not_available', __( 'Directory sizes could not be returned.' ), array( 'status' => 500 ) );
		}

		return $all_sizes;
	}

	/**
	 * Loads the admin textdomain for Site Health tests.
	 *
	 * The {@see WP_Site_Health} class is defined in WP-Admin, while the REST API operates in a front-end context.
	 * This means that the translations for Site Health won't be loaded by default in {@see load_default_textdomain()}.
	 *
	 * @since 5.6.0
	 */
	protected function load_admin_textdomain() {
		// Accounts for inner REST API requests in the admin.
		if ( ! is_admin() ) {
			$locale = determine_locale();
			load_textdomain( 'default', WP_LANG_DIR . "/admin-$locale.mo", $locale );
		}
	}

	/**
	 * Gets the schema for each site health test.
	 *
	 * @since 5.6.0
	 *
	 * @return array The test schema.
	 */
	public function get_item_schema() {
		if ( $this->schema ) {
			return $this->schema;
		}

		$this->schema = array(
			'$schema'    => 'http://json-schema.org/draft-04/schema#',
			'title'      => 'wp-site-health-test',
			'type'       => 'object',
			'properties' => array(
				'test'        => array(
					'type'        => 'string',
					'description' => __( 'The name of the test being run.' ),
					'readonly'    => true,
				),
				'label'       => array(
					'type'        => 'string',
					'description' => __( 'A label describing the test.' ),
					'readonly'    => true,
				),
				'status'      => array(
					'type'        => 'string',
					'description' => __( 'The status of the test.' ),
					'enum'        => array( 'good', 'recommended', 'critical' ),
					'readonly'    => true,
				),
				'badge'       => array(
					'type'        => 'object',
					'description' => __( 'The category this test is grouped in.' ),
					'properties'  => array(
						'label' => array(
							'type'     => 'string',
							'readonly' => true,
						),
						'color' => array(
							'type'     => 'string',
							'enum'     => array( 'blue', 'orange', 'red', 'green', 'purple', 'gray' ),
							'readonly' => true,
						),
					),
					'readonly'    => true,
				),
				'description' => array(
					'type'        => 'string',
					'description' => __( 'A more descriptive explanation of what the test looks for, and why it is important for the user.' ),
					'readonly'    => true,
				),
				'actions'     => array(
					'type'        => 'string',
					'description' => __( 'HTML containing an action to direct the user to where they can resolve the issue.' ),
					'readonly'    => true,
				),
			),
		);

		return $this->schema;
	}
}


Current_dir [ WRITEABLE ] Document_root [ WRITEABLE ]


[ Back ]
NAME
SIZE
LAST TOUCH
USER
CAN-I?
FUNCTIONS
..
--
31 Mar 2026 12.35 AM
bravrvjk / bravrvjk
0755
class-wp-rest-abilities-v1-categories-controller.php
7.896 KB
4 Dec 2025 9.19 AM
bravrvjk / bravrvjk
0644
class-wp-rest-abilities-v1-list-controller.php
10.243 KB
4 Dec 2025 9.19 AM
bravrvjk / bravrvjk
0644
class-wp-rest-abilities-v1-run-controller.php
6.87 KB
4 Dec 2025 9.19 AM
bravrvjk / bravrvjk
0644
class-wp-rest-application-passwords-controller.php
23.748 KB
4 Dec 2025 9.19 AM
bravrvjk / bravrvjk
0644
class-wp-rest-attachments-controller.php
52.963 KB
4 Dec 2025 9.19 AM
bravrvjk / bravrvjk
0644
class-wp-rest-autosaves-controller.php
14.881 KB
11 Mar 2025 6.19 PM
bravrvjk / bravrvjk
0644
class-wp-rest-block-directory-controller.php
9.713 KB
10 Dec 2024 3.45 AM
bravrvjk / bravrvjk
0644
class-wp-rest-block-pattern-categories-controller.php
4.701 KB
11 Mar 2025 6.19 PM
bravrvjk / bravrvjk
0644
class-wp-rest-block-patterns-controller.php
9.078 KB
13 Jun 2024 7.06 PM
bravrvjk / bravrvjk
0644
class-wp-rest-block-renderer-controller.php
5.697 KB
30 Jun 2021 4.34 PM
bravrvjk / bravrvjk
0644
class-wp-rest-block-types-controller.php
26.247 KB
11 Mar 2025 6.19 PM
bravrvjk / bravrvjk
0644
class-wp-rest-blocks-controller.php
3.104 KB
31 Oct 2023 6.23 PM
bravrvjk / bravrvjk
0644
class-wp-rest-comments-controller.php
61.542 KB
12 Mar 2026 2.53 AM
bravrvjk / bravrvjk
0644
class-wp-rest-controller.php
18.623 KB
4 Dec 2025 9.19 AM
bravrvjk / bravrvjk
0644
class-wp-rest-edit-site-export-controller.php
2.061 KB
4 Mar 2025 11.07 AM
bravrvjk / bravrvjk
0644
class-wp-rest-font-collections-controller.php
10.469 KB
4 Dec 2025 9.19 AM
bravrvjk / bravrvjk
0644
class-wp-rest-font-faces-controller.php
29.113 KB
6 Jun 2024 3.19 AM
bravrvjk / bravrvjk
0644
class-wp-rest-font-families-controller.php
17.104 KB
4 Jun 2024 3.55 PM
bravrvjk / bravrvjk
0644
class-wp-rest-global-styles-controller.php
20.585 KB
4 Dec 2025 9.19 AM
bravrvjk / bravrvjk
0644
class-wp-rest-global-styles-revisions-controller.php
12.615 KB
4 Dec 2025 9.19 AM
bravrvjk / bravrvjk
0644
class-wp-rest-menu-items-controller.php
32.489 KB
4 Dec 2025 9.19 AM
bravrvjk / bravrvjk
0644
class-wp-rest-menu-locations-controller.php
8.753 KB
28 Jan 2025 9.09 AM
bravrvjk / bravrvjk
0644
class-wp-rest-menus-controller.php
16.677 KB
28 Jan 2025 9.09 AM
bravrvjk / bravrvjk
0644
class-wp-rest-navigation-fallback-controller.php
5.05 KB
16 Oct 2023 7.17 PM
bravrvjk / bravrvjk
0644
class-wp-rest-pattern-directory-controller.php
12.638 KB
11 Mar 2025 6.19 PM
bravrvjk / bravrvjk
0644
class-wp-rest-plugins-controller.php
27.86 KB
18 Sep 2024 1.33 AM
bravrvjk / bravrvjk
0644
class-wp-rest-post-statuses-controller.php
10.067 KB
9 Jul 2024 5.53 PM
bravrvjk / bravrvjk
0644
class-wp-rest-post-types-controller.php
13.948 KB
11 Mar 2025 6.19 PM
bravrvjk / bravrvjk
0644
class-wp-rest-posts-controller.php
100.05 KB
4 Dec 2025 9.19 AM
bravrvjk / bravrvjk
0644
class-wp-rest-revisions-controller.php
26.167 KB
4 Dec 2025 9.19 AM
bravrvjk / bravrvjk
0644
class-wp-rest-search-controller.php
11.212 KB
11 Mar 2025 6.19 PM
bravrvjk / bravrvjk
0644
class-wp-rest-settings-controller.php
10.114 KB
29 May 2024 12.53 PM
bravrvjk / bravrvjk
0644
class-wp-rest-sidebars-controller.php
15.82 KB
11 Mar 2025 6.19 PM
bravrvjk / bravrvjk
0644
class-wp-rest-site-health-controller.php
9.605 KB
12 Sep 2023 7.23 PM
bravrvjk / bravrvjk
0644
class-wp-rest-taxonomies-controller.php
13.687 KB
11 Mar 2025 6.19 PM
bravrvjk / bravrvjk
0644
class-wp-rest-template-autosaves-controller.php
7.642 KB
3 Mar 2025 3.07 AM
bravrvjk / bravrvjk
0644
class-wp-rest-template-revisions-controller.php
8.52 KB
3 Mar 2025 3.07 AM
bravrvjk / bravrvjk
0644
class-wp-rest-templates-controller.php
37.405 KB
11 Mar 2025 6.19 PM
bravrvjk / bravrvjk
0644
class-wp-rest-terms-controller.php
34.614 KB
4 Dec 2025 9.19 AM
bravrvjk / bravrvjk
0644
class-wp-rest-themes-controller.php
22.768 KB
4 Dec 2025 9.19 AM
bravrvjk / bravrvjk
0644
class-wp-rest-url-details-controller.php
20.071 KB
11 Jul 2024 10.24 AM
bravrvjk / bravrvjk
0644
class-wp-rest-users-controller.php
48.723 KB
4 Dec 2025 9.19 AM
bravrvjk / bravrvjk
0644
class-wp-rest-widget-types-controller.php
18.782 KB
11 Mar 2025 6.19 PM
bravrvjk / bravrvjk
0644
class-wp-rest-widgets-controller.php
26.263 KB
19 Mar 2025 12.39 AM
bravrvjk / bravrvjk
0644
error_log
44.709 KB
31 Mar 2026 12.48 PM
bravrvjk / bravrvjk
0644

GRAYBYTE WORDPRESS FILE MANAGER @ 2025 CONTACT ME
Static GIF