Site Health: Remove use of deprecated function from wp_is_https_supported().

Follow up to [56664].

Props peter8nss, debarghyabanerjee, sebastienserre, geekofshire, swissspidy, desrosj.
Fixes #62252.
See #58494.

Built from https://develop.svn.wordpress.org/trunk@59517


git-svn-id: http://core.svn.wordpress.org/trunk@58903 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Felix Arntz 2024-12-16 14:08:24 +00:00
parent 15f2879461
commit f7d4ea3ceb
2 changed files with 13 additions and 11 deletions

View File

@ -63,31 +63,33 @@ function wp_is_site_url_using_https() {
/** /**
* Checks whether HTTPS is supported for the server and domain. * Checks whether HTTPS is supported for the server and domain.
* *
* This function makes an HTTP request through `wp_get_https_detection_errors()`
* to check for HTTPS support. As this process can be resource-intensive,
* it should be used cautiously, especially in performance-sensitive environments,
* to avoid potential latency issues.
*
* @since 5.7.0 * @since 5.7.0
* *
* @return bool True if HTTPS is supported, false otherwise. * @return bool True if HTTPS is supported, false otherwise.
*/ */
function wp_is_https_supported() { function wp_is_https_supported() {
$https_detection_errors = get_option( 'https_detection_errors' ); $https_detection_errors = wp_get_https_detection_errors();
// If option has never been set by the Cron hook before, run it on-the-fly as fallback. // If there are errors, HTTPS is not supported.
if ( false === $https_detection_errors ) {
wp_update_https_detection_errors();
$https_detection_errors = get_option( 'https_detection_errors' );
}
// If there are no detection errors, HTTPS is supported.
return empty( $https_detection_errors ); return empty( $https_detection_errors );
} }
/** /**
* Runs a remote HTTPS request to detect whether HTTPS supported, and stores potential errors. * Runs a remote HTTPS request to detect whether HTTPS supported, and stores potential errors.
* *
* This internal function is called by a regular Cron hook to ensure HTTPS support is detected and maintained. * This function checks for HTTPS support by making an HTTP request. As this process can be resource-intensive,
* it should be used cautiously, especially in performance-sensitive environments.
* It is called when HTTPS support needs to be validated.
* *
* @since 6.4.0 * @since 6.4.0
* @access private * @access private
*
* @return array An array containing potential detection errors related to HTTPS, or an empty array if no errors are found.
*/ */
function wp_get_https_detection_errors() { function wp_get_https_detection_errors() {
/** /**

View File

@ -16,7 +16,7 @@
* *
* @global string $wp_version * @global string $wp_version
*/ */
$wp_version = '6.8-alpha-59516'; $wp_version = '6.8-alpha-59517';
/** /**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema. * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.