From 8fa1b1d69668ecbbab33d0f78b811d063266ad2e Mon Sep 17 00:00:00 2001 From: Peter Wilson Date: Mon, 12 Aug 2024 04:54:15 +0000 Subject: [PATCH] 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. Props clorith, aristath, narenin, kowsar89, hellofromTonya, ironprogrammer, shailu25. Fixes #61638. Built from https://develop.svn.wordpress.org/trunk@58884 git-svn-id: http://core.svn.wordpress.org/trunk@58280 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-admin/includes/class-wp-debug-data.php | 12 ++++++++++++ wp-includes/version.php | 2 +- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/wp-admin/includes/class-wp-debug-data.php b/wp-admin/includes/class-wp-debug-data.php index 1d4ab39aa8..f626dc4c4a 100644 --- a/wp-admin/includes/class-wp-debug-data.php +++ b/wp-admin/includes/class-wp-debug-data.php @@ -1695,6 +1695,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 ); diff --git a/wp-includes/version.php b/wp-includes/version.php index bc765841e1..50334906c4 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -16,7 +16,7 @@ * * @global string $wp_version */ -$wp_version = '6.7-alpha-58883'; +$wp_version = '6.7-alpha-58884'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.