WordPress как на ладони
Недорогой хостинг для сайтов на WordPress: wordpress.jino.ru Платформа для конвертации и монетизации трафика
функция не описана

WP_REST_Site_Health_Controller::get_directory_sizes() public WP 5.6.0

Gets the current directory sizes for this install.

{} Это метод класса: WP_REST_Site_Health_Controller{}

Хуков нет.

Возвращает

Массив/WP_Error.

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

$WP_REST_Site_Health_Controller = new WP_REST_Site_Health_Controller();
$WP_REST_Site_Health_Controller->get_directory_sizes();

Список изменений

С версии 5.6.0 Введена.

Код WP_REST_Site_Health_Controller::get_directory_sizes() WP 5.6.2

<?php
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;
}