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
This commit is contained in:
audrasjb 2025-02-21 14:52:24 +00:00
parent d8b45098da
commit 7f13d32bc2
2 changed files with 9 additions and 4 deletions

View File

@ -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',
),
);

View File

@ -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.