Site Health: Make sure the `submit_button()` function is available in `request_filesystem_credentials()`.

This avoids a fatal error when the function is called via REST API from `WP_Site_Health_Auto_Updates::test_check_wp_filesystem_method()`.

Props lakrisgubben, mukesh27, Clorith, SergeyBiryukov.
Fixes #53206.
Built from https://develop.svn.wordpress.org/trunk@50979


git-svn-id: http://core.svn.wordpress.org/trunk@50588 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Sergey Biryukov 2021-05-24 19:24:57 +00:00
parent 209074f5e1
commit c4182fd00f
3 changed files with 9 additions and 3 deletions

View File

@ -273,7 +273,7 @@ class WP_Site_Health_Auto_Updates {
* @return array The test results.
*/
function test_check_wp_filesystem_method() {
// Make sure the `request_filesystem_credentials` function is available during our REST call.
// Make sure the `request_filesystem_credentials()` function is available during our REST API call.
if ( ! function_exists( 'request_filesystem_credentials' ) ) {
require_once ABSPATH . '/wp-admin/includes/file.php';
}
@ -324,7 +324,7 @@ class WP_Site_Health_Auto_Updates {
return false;
}
// Make sure the `get_core_checksums` function is available during our REST call.
// Make sure the `get_core_checksums()` function is available during our REST API call.
if ( ! function_exists( 'get_core_checksums' ) ) {
require_once ABSPATH . '/wp-admin/includes/update.php';
}

View File

@ -2369,6 +2369,12 @@ function request_filesystem_credentials( $form_post, $type = '', $error = false,
echo '<input type="hidden" name="' . esc_attr( $field ) . '" value="' . esc_attr( $submitted_form[ $field ] ) . '" />';
}
}
// Make sure the `submit_button()` function is available during the REST API call
// from WP_Site_Health_Auto_Updates::test_check_wp_filesystem_method().
if ( ! function_exists( 'submit_button' ) ) {
require_once ABSPATH . '/wp-admin/includes/template.php';
}
?>
<p class="request-filesystem-credentials-action-buttons">
<?php wp_nonce_field( 'filesystem-credentials', '_fs_nonce', false, true ); ?>

View File

@ -13,7 +13,7 @@
*
* @global string $wp_version
*/
$wp_version = '5.8-alpha-50978';
$wp_version = '5.8-alpha-50979';
/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.