Site Health: Use an integer value as a fallback in the available disk space check.

This avoids a few type problems further in the code: boolean divided by a number, or passing `false` to `size_format()` which is documented to accept integers or strings only.

Follow-up to [51815].

Props TobiasBg.
See #51857.
Built from https://develop.svn.wordpress.org/trunk@51898


git-svn-id: http://core.svn.wordpress.org/trunk@51491 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Sergey Biryukov 2021-10-09 02:50:56 +00:00
parent aef14e6d1b
commit 0f2d2264b5
2 changed files with 2 additions and 2 deletions

View File

@ -1890,7 +1890,7 @@ class WP_Site_Health {
* @return array The test results.
*/
public function get_test_available_updates_disk_space() {
$available_space = function_exists( 'disk_free_space' ) ? (int) @disk_free_space( WP_CONTENT_DIR . '/upgrade/' ) : false;
$available_space = function_exists( 'disk_free_space' ) ? (int) @disk_free_space( WP_CONTENT_DIR . '/upgrade/' ) : 0;
$available_space_in_mb = $available_space / MB_IN_BYTES;
$result = array(

View File

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