From 7f13d32bc2139221766c3db82b40acba635396bb Mon Sep 17 00:00:00 2001 From: audrasjb Date: Fri, 21 Feb 2025 14:52:24 +0000 Subject: [PATCH] Site Health: Improve fonts directory check. This changeset enhances the filesystem checks in the Site Health debug data by addressing the following: - Existence Check: Before checking if the fonts directory is writable, it first verifies whether the directory exists. - Improved Messaging: If the fonts directory does not exist, the debug output now reflects this scenario as "Does not exist". If the directory exists, it shows whether it is writable or not. Props zodiac1978, samiamnot, sainathpoojary, abcd95, ankitkumarshah, im3dabasia1. Fixes #62633. Built from https://develop.svn.wordpress.org/trunk@59853 git-svn-id: http://core.svn.wordpress.org/trunk@59195 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-admin/includes/class-wp-debug-data.php | 11 ++++++++--- wp-includes/version.php | 2 +- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/wp-admin/includes/class-wp-debug-data.php b/wp-admin/includes/class-wp-debug-data.php index f227c9fdd2..8f959d6c49 100644 --- a/wp-admin/includes/class-wp-debug-data.php +++ b/wp-admin/includes/class-wp-debug-data.php @@ -1646,12 +1646,13 @@ class WP_Debug_Data { */ private static function get_wp_filesystem(): array { $upload_dir = wp_upload_dir(); + $fonts_dir_exists = file_exists( wp_get_font_dir()['basedir'] ); $is_writable_abspath = wp_is_writable( ABSPATH ); $is_writable_wp_content_dir = wp_is_writable( WP_CONTENT_DIR ); $is_writable_upload_dir = wp_is_writable( $upload_dir['basedir'] ); $is_writable_wp_plugin_dir = wp_is_writable( WP_PLUGIN_DIR ); $is_writable_template_directory = wp_is_writable( get_theme_root( get_template() ) ); - $is_writable_fonts_dir = wp_is_writable( wp_get_font_dir()['basedir'] ); + $is_writable_fonts_dir = $fonts_dir_exists ? wp_is_writable( wp_get_font_dir()['basedir'] ) : false; $fields = array( 'wordpress' => array( @@ -1681,8 +1682,12 @@ class WP_Debug_Data { ), 'fonts' => array( 'label' => __( 'The fonts directory' ), - 'value' => ( $is_writable_fonts_dir ? __( 'Writable' ) : __( 'Not writable' ) ), - 'debug' => ( $is_writable_fonts_dir ? 'writable' : 'not writable' ), + 'value' => $fonts_dir_exists + ? ( $is_writable_fonts_dir ? __( 'Writable' ) : __( 'Not writable' ) ) + : __( 'Does not exist' ), + 'debug' => $fonts_dir_exists + ? ( $is_writable_fonts_dir ? 'writable' : 'not writable' ) + : 'does not exist', ), ); diff --git a/wp-includes/version.php b/wp-includes/version.php index 7e74a37fad..0d3ef1b9d1 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -16,7 +16,7 @@ * * @global string $wp_version */ -$wp_version = '6.8-alpha-59852'; +$wp_version = '6.8-alpha-59853'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.