[ Index ]

PHP Cross Reference of WordPress Trunk (Updated Daily)

Search

title

Body

[close]

/wp-admin/includes/ -> class-wp-site-health.php (summary)

(no description)

File Size: 3626 lines (122 kb)
Included or required: 7 times
Referenced: 0 times
Includes or requires: 4 files
 wp-admin/includes/misc.php
 wp-admin/site-health-info.php
 wp-admin/includes/file.php
 wp-admin/includes/class-wp-site-health-auto-updates.php

Defines 1 class

WP_Site_Health:: (51 methods):
  __construct()
  show_site_health_tab()
  get_instance()
  enqueue_scripts()
  perform_test()
  prepare_sql_data()
  check_wp_version_check_exists()
  get_test_wordpress_version()
  get_test_plugin_version()
  get_test_theme_version()
  get_test_php_version()
  test_php_extension_availability()
  get_test_php_extensions()
  get_test_php_default_timezone()
  get_test_php_sessions()
  get_test_sql_server()
  get_test_dotorg_communication()
  get_test_is_in_debug_mode()
  get_test_https_status()
  get_test_ssl_support()
  get_test_scheduled_events()
  get_test_background_updates()
  get_test_plugin_theme_auto_updates()
  get_test_available_updates_disk_space()
  get_test_update_temp_backup_writable()
  get_test_loopback_requests()
  get_test_http_requests()
  get_test_rest_availability()
  get_test_file_uploads()
  get_test_authorization_header()
  get_test_page_cache()
  get_test_persistent_object_cache()
  get_autoloaded_options_size()
  get_test_autoloaded_options()
  get_tests()
  admin_body_class()
  wp_schedule_test_init()
  get_cron_tasks()
  has_missed_cron()
  has_late_cron()
  detect_plugin_theme_auto_update_issues()
  can_perform_loopback()
  maybe_create_scheduled_event()
  wp_cron_scheduled_check()
  is_development_environment()
  get_page_cache_headers()
  check_for_page_caching()
  get_page_cache_detail()
  get_good_response_time_threshold()
  should_suggest_persistent_object_cache()
  available_object_cache_services()


Class: WP_Site_Health  - X-Ref

Class for looking up a site's health based on a user's WordPress environment.

__construct()   X-Ref
WP_Site_Health constructor.


show_site_health_tab( $tab )   X-Ref
Outputs the content of a tab in the Site Health screen.

param: string $tab Slug of the current tab being displayed.

get_instance()   X-Ref
Returns an instance of the WP_Site_Health class, or create one if none exist yet.

return: WP_Site_Health|null

enqueue_scripts()   X-Ref
Enqueues the site health scripts.


perform_test( $callback )   X-Ref
Runs a Site Health test directly.

param: callable $callback
return: mixed|void

prepare_sql_data()   X-Ref
Runs the SQL version checks.

These values are used in later tests, but the part of preparing them is more easily managed
early in the class for ease of access and discovery.


check_wp_version_check_exists()   X-Ref
Tests whether `wp_version_check` is blocked.

It's possible to block updates with the `wp_version_check` filter, but this can't be checked
during an Ajax call, as the filter is never introduced then.

This filter overrides a standard page request if it's made by an admin through the Ajax call
with the right query argument to check for this.


get_test_wordpress_version()   X-Ref
Tests for WordPress version and outputs it.

Gives various results depending on what kind of updates are available, if any, to encourage
the user to install security updates as a priority.

return: array The test result.

get_test_plugin_version()   X-Ref
Tests if plugins are outdated, or unnecessary.

The test checks if your plugins are up to date, and encourages you to remove any
that are not in use.

return: array The test result.

get_test_theme_version()   X-Ref
Tests if themes are outdated, or unnecessary.

Checks if your site has a default theme (to fall back on if there is a need),
if your themes are up to date and, finally, encourages you to remove any themes
that are not needed.

return: array The test results.

get_test_php_version()   X-Ref
Tests if the supplied PHP version is supported.

return: array The test results.

test_php_extension_availability( $extension_name = null, $function_name = null, $constant_name = null, $class_name = null )   X-Ref
Checks if the passed extension or function are available.

Make the check for available PHP modules into a simple boolean operator for a cleaner test runner.

param: string $extension_name Optional. The extension name to test. Default null.
param: string $function_name  Optional. The function name to test. Default null.
param: string $constant_name  Optional. The constant name to test for. Default null.
param: string $class_name     Optional. The class name to test for. Default null.
return: bool Whether or not the extension and function are available.

get_test_php_extensions()   X-Ref
Tests if required PHP modules are installed on the host.

This test builds on the recommendations made by the WordPress Hosting Team
as seen at https://make.wordpress.org/hosting/handbook/handbook/server-environment/#php-extensions

return: array

get_test_php_default_timezone()   X-Ref
Tests if the PHP default timezone is set to UTC.

return: array The test results.

get_test_php_sessions()   X-Ref
Tests if there's an active PHP session that can affect loopback requests.

return: array The test results.

get_test_sql_server()   X-Ref
Tests if the SQL server is up to date.

return: array The test results.

get_test_dotorg_communication()   X-Ref
Tests if the site can communicate with WordPress.org.

return: array The test results.

get_test_is_in_debug_mode()   X-Ref
Tests if debug information is enabled.

When WP_DEBUG is enabled, errors and information may be disclosed to site visitors,
or logged to a publicly accessible file.

Debugging is also frequently left enabled after looking for errors on a site,
as site owners do not understand the implications of this.

return: array The test results.

get_test_https_status()   X-Ref
Tests if the site is serving content over HTTPS.

Many sites have varying degrees of HTTPS support, the most common of which is sites that have it
enabled, but only if you visit the right site address.

return: array The test results.

get_test_ssl_support()   X-Ref
Checks if the HTTP API can handle SSL/TLS requests.

return: array The test result.

get_test_scheduled_events()   X-Ref
Tests if scheduled events run as intended.

If scheduled events are not running, this may indicate something with WP_Cron is not working
as intended, or that there are orphaned events hanging around from older code.

return: array The test results.

get_test_background_updates()   X-Ref
Tests if WordPress can run automated background updates.

Background updates in WordPress are primarily used for minor releases and security updates.
It's important to either have these working, or be aware that they are intentionally disabled
for whatever reason.

return: array The test results.

get_test_plugin_theme_auto_updates()   X-Ref
Tests if plugin and theme auto-updates appear to be configured correctly.

return: array The test results.

get_test_available_updates_disk_space()   X-Ref
Tests available disk space for updates.

return: array The test results.

get_test_update_temp_backup_writable()   X-Ref
Tests if plugin and theme temporary backup directories are writable or can be created.

return: array The test results.

get_test_loopback_requests()   X-Ref
Tests if loopbacks work as expected.

A loopback is when WordPress queries itself, for example to start a new WP_Cron instance,
or when editing a plugin or theme. This has shown itself to be a recurring issue,
as code can very easily break this interaction.

return: array The test results.

get_test_http_requests()   X-Ref
Tests if HTTP requests are blocked.

It's possible to block all outgoing communication (with the possibility of allowing certain
hosts) via the HTTP API. This may create problems for users as many features are running as
services these days.

return: array The test results.

get_test_rest_availability()   X-Ref
Tests if the REST API is accessible.

Various security measures may block the REST API from working, or it may have been disabled in general.
This is required for the new block editor to work, so we explicitly test for this.

return: array The test results.

get_test_file_uploads()   X-Ref
Tests if 'file_uploads' directive in PHP.ini is turned off.

return: array The test results.

get_test_authorization_header()   X-Ref
Tests if the Authorization header has the expected values.

return: array

get_test_page_cache()   X-Ref
Tests if a full page cache is available.

return: array The test result.

get_test_persistent_object_cache()   X-Ref
Tests if the site uses persistent object cache and recommends to use it if not.

return: array The test result.

get_autoloaded_options_size()   X-Ref
Calculates total amount of autoloaded data.

return: int Autoloaded data in bytes.

get_test_autoloaded_options()   X-Ref
Tests the number of autoloaded options.

return: array The test results.

get_tests()   X-Ref
Returns a set of tests that belong to the site status page.

Each site status test is defined here, they may be `direct` tests, that run on page load, or `async` tests
which will run later down the line via JavaScript calls to improve page performance and hopefully also user
experiences.

return: array The list of tests to run.

admin_body_class( $body_class )   X-Ref
Adds a class to the body HTML tag.

Filters the body class string for admin pages and adds our own class for easier styling.

param: string $body_class The body class string.
return: string The modified body class string.

wp_schedule_test_init()   X-Ref
Initiates the WP_Cron schedule test cases.


get_cron_tasks()   X-Ref
Populates the list of cron events and store them to a class-wide variable.


has_missed_cron()   X-Ref
Checks if any scheduled tasks have been missed.

Returns a boolean value of `true` if a scheduled task has been missed and ends processing.

If the list of crons is an instance of WP_Error, returns the instance instead of a boolean value.

return: bool|WP_Error True if a cron was missed, false if not. WP_Error if the cron is set to that.

has_late_cron()   X-Ref
Checks if any scheduled tasks are late.

Returns a boolean value of `true` if a scheduled task is late and ends processing.

If the list of crons is an instance of WP_Error, returns the instance instead of a boolean value.

return: bool|WP_Error True if a cron is late, false if not. WP_Error if the cron is set to that.

detect_plugin_theme_auto_update_issues()   X-Ref
Checks for potential issues with plugin and theme auto-updates.

Though there is no way to 100% determine if plugin and theme auto-updates are configured
correctly, a few educated guesses could be made to flag any conditions that would
potentially cause unexpected behaviors.

return: object The test results.

can_perform_loopback()   X-Ref
Runs a loopback test on the site.

Loopbacks are what WordPress uses to communicate with itself to start up WP_Cron, scheduled posts,
make sure plugin or theme edits don't cause site failures and similar.

return: object The test results.

maybe_create_scheduled_event()   X-Ref
Creates a weekly cron event, if one does not already exist.


wp_cron_scheduled_check()   X-Ref
Runs the scheduled event to check and update the latest site health status for the website.


is_development_environment()   X-Ref
Checks if the current environment type is set to 'development' or 'local'.

return: bool True if it is a development environment, false if not.

get_page_cache_headers()   X-Ref
Returns a list of headers and its verification callback to verify if page cache is enabled or not.

Note: key is header name and value could be callable function to verify header value.
Empty value mean existence of header detect page cache is enabled.

return: array List of client caching headers and their (optional) verification callbacks.

check_for_page_caching()   X-Ref
Checks if site has page cache enabled or not.

return: WP_Error|array {

get_page_cache_detail()   X-Ref
Gets page cache details.

return: WP_Error|array {

get_good_response_time_threshold()   X-Ref
Gets the threshold below which a response time is considered good.

return: int Threshold in milliseconds.

should_suggest_persistent_object_cache()   X-Ref
Determines whether to suggest using a persistent object cache.

return: bool Whether to suggest using a persistent object cache.

available_object_cache_services()   X-Ref
Returns a list of available persistent object cache services.

return: string[] The list of available persistent object cache services.



Generated : Thu Nov 21 08:20:01 2024 Cross-referenced by PHPXref