[ 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: 2598 lines (81 kb)
Included or required: 8 times
Referenced: 0 times
Includes or requires: 1 file
 wp-admin/includes/class-wp-site-health-auto-updates.php

Defines 1 class

WP_Site_Health:: (37 methods):
  __construct()
  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_utf8mb4_support()
  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_loopback_requests()
  get_test_http_requests()
  get_test_rest_availability()
  get_test_file_uploads()
  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()


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.


get_instance()   X-Ref
Return 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
Run a Site Health test directly.

return: mixed|void
param: callable $callback

prepare_sql_data()   X-Ref
Run 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
Test if `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
Test if plugins are outdated, or unnecessary.

The tests 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
Test if themes are outdated, or unnecessary.

–°hecks 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
Test if the supplied PHP version is supported.

return: array The test results.

test_php_extension_availability( $extension = null, $function = null, $constant = null, $class = null )   X-Ref
Check 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.

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

get_test_php_extensions()   X-Ref
Test 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
Test if the PHP default timezone is set to UTC.

return: array The test results.

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

return: array The test results.

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

return: array The test results.

get_test_utf8mb4_support()   X-Ref
Test if the database server is capable of using utf8mb4.

return: array The test results.

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

return: array The test results.

get_test_is_in_debug_mode()   X-Ref
Test 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
Test if your 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
Check if the HTTP API can handle SSL/TLS requests.

return: array The test results.

get_test_scheduled_events()   X-Ref
Test 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
Test 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
Test if plugin and theme auto-updates appear to be configured correctly.

return: array The test results.

get_test_loopback_requests()   X-Ref
Test 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
Test 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
Test 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
Test if 'file_uploads' directive in PHP.ini is turned off.

return: array The test results.

get_tests()   X-Ref
Return 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
Add a class to the body HTML tag.

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

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

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


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


has_missed_cron()   X-Ref
Check 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
Check 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
Check 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
Run a loopback test on our 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
Create a weekly cron event, if one does not already exist.


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




Generated : Tue Sep 22 08:20:01 2020 Cross-referenced by PHPXref