Make WordPress Core

Changeset 59853


Ignore:
Timestamp:
02/21/2025 02:50:17 PM (8 weeks ago)
Author:
audrasjb
Message:

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.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-admin/includes/class-wp-debug-data.php

    r59290 r59853  
    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 );
     
    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(
     
    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        );
Note: See TracChangeset for help on using the changeset viewer.