Skip to content

Commit 1d77cfa

Browse files
committed
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. git-svn-id: https://develop.svn.wordpress.org/trunk@59853 602fd350-edb4-49c9-b593-d223f7449a82
1 parent d9b9fa5 commit 1d77cfa

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

src/wp-admin/includes/class-wp-debug-data.php

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1646,12 +1646,13 @@ private static function get_wp_database(): array {
16461646
*/
16471647
private static function get_wp_filesystem(): array {
16481648
$upload_dir = wp_upload_dir();
1649+
$fonts_dir_exists = file_exists( wp_get_font_dir()['basedir'] );
16491650
$is_writable_abspath = wp_is_writable( ABSPATH );
16501651
$is_writable_wp_content_dir = wp_is_writable( WP_CONTENT_DIR );
16511652
$is_writable_upload_dir = wp_is_writable( $upload_dir['basedir'] );
16521653
$is_writable_wp_plugin_dir = wp_is_writable( WP_PLUGIN_DIR );
16531654
$is_writable_template_directory = wp_is_writable( get_theme_root( get_template() ) );
1654-
$is_writable_fonts_dir = wp_is_writable( wp_get_font_dir()['basedir'] );
1655+
$is_writable_fonts_dir = $fonts_dir_exists ? wp_is_writable( wp_get_font_dir()['basedir'] ) : false;
16551656

16561657
$fields = array(
16571658
'wordpress' => array(
@@ -1681,8 +1682,12 @@ private static function get_wp_filesystem(): array {
16811682
),
16821683
'fonts' => array(
16831684
'label' => __( 'The fonts directory' ),
1684-
'value' => ( $is_writable_fonts_dir ? __( 'Writable' ) : __( 'Not writable' ) ),
1685-
'debug' => ( $is_writable_fonts_dir ? 'writable' : 'not writable' ),
1685+
'value' => $fonts_dir_exists
1686+
? ( $is_writable_fonts_dir ? __( 'Writable' ) : __( 'Not writable' ) )
1687+
: __( 'Does not exist' ),
1688+
'debug' => $fonts_dir_exists
1689+
? ( $is_writable_fonts_dir ? 'writable' : 'not writable' )
1690+
: 'does not exist',
16861691
),
16871692
);
16881693

0 commit comments

Comments
 (0)