Site Health: Check if directories exist before checking size.

Prevents the Site Health Debug tab from stalling when reporting directory sizes if the directory does not exist.

Reviewed by hellofromTonya.
Merges [58884] to the 6.6 branch.

Props clorith, aristath, narenin, kowsar89, hellofromTonya, ironprogrammer, shailu25.
Fixes #61638.
Built from https://develop.svn.wordpress.org/branches/6.6@58891


git-svn-id: http://core.svn.wordpress.org/branches/6.6@58287 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
hellofromTonya 2024-08-13 18:41:18 +00:00
parent c5f96c8c1e
commit 3ab9d9a827
2 changed files with 13 additions and 1 deletions

View File

@ -1670,6 +1670,18 @@ class WP_Debug_Data {
'raw' => 0,
);
// If the directory does not exist, skip checking it, as it will skew the other results.
if ( ! is_dir( $path ) ) {
$all_sizes[ $name ] = array(
'path' => $path,
'raw' => 0,
'size' => __( 'The directory does not exist.' ),
'debug' => 'directory not found',
);
continue;
}
if ( microtime( true ) - WP_START_TIMESTAMP < $max_execution_time ) {
if ( 'wordpress_size' === $name ) {
$dir_size = recurse_dirsize( $path, $exclude, $max_execution_time );

View File

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