Make WordPress Core

Opened 7 months ago

Closed 4 months ago

Last modified 6 weeks ago

#62633 closed defect (bug) (fixed)

Is writable check for fonts folder is misleading/wrong

Reported by: zodiac1978's profile zodiac1978 Owned by: audrasjb's profile audrasjb
Milestone: 6.8 Priority: normal
Severity: normal Version: 6.5
Component: Site Health Keywords: has-patch has-screenshots has-test-info commit
Focuses: Cc:

Description

If no font library is used, the check for folders permissions in Site Health is returning “not writable” for the fonts directory because it does not exist.

I think this is misleading. Maybe it could be created and would be writable then, but it is just not there at the moment.

Attachments (1)

Bildschirmfoto 2024-11-26 um 15.07.35.png (226.3 KB) - added by zodiac1978 7 months ago.
Site Health check showing the fonts directory as not writable (although there are no permission issues)

Download all attachments as: .zip

Change History (18)

@zodiac1978
7 months ago

Site Health check showing the fonts directory as not writable (although there are no permission issues)

#1 @samiamnot
7 months ago

Introduced with #60719 (version 6.6 would be correct, but does not seem available as an option). #61638 is somewhat related.

#2 @sainathpoojary
7 months ago

Reproduction Report

Description

This report validates whether the issue can be reproduced.

Environment

  • WordPress: 6.8-alpha-59274-src
  • PHP: 8.2.26
  • Server: nginx/1.27.3
  • Database: mysqli (Server: 8.0.40 / Client: mysqlnd 8.2.26)
  • Browser: Chrome 131.0.0.0
  • OS: macOS
  • Theme: Twenty Twenty-Five 1.0
  • MU Plugins: None activated
  • Plugins: Test Reports 1.2.0

Actual Results

✅ Error condition occurs.

Supplemental Artifacts

https://utfs.io/f/PL8E4NiPUWyOKJRJs2YmLeRwrnj39TqHcCJ7Kk0pPsmyaZFi

This ticket was mentioned in PR #7933 on WordPress/wordpress-develop by @sainathpoojary.


7 months ago
#3

  • Keywords has-patch added; needs-patch removed

This PR enhances the filesystem checks in the Site Health debug data by addressing the following:

#### 1. Existence Check

  • Before checking if the fonts directory is writable, it first verifies whether the directory exists.

#### 2. 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.

### Changes Made

  • Updated the get_wp_filesystem() method in class-wp-debug-data.php.
  • Added a directory existence check (file_exists) for the fonts directory (wp_get_font_dir()['basedir']).
  • Adjusted the debug data output to handle cases where the fonts directory does not exist.

### Before fix:
Without Font directory

https://github.com/user-attachments/assets/44a3dae9-b07c-4c7e-9b78-15432d0a917b

### After fix:

Without Font directory

https://github.com/user-attachments/assets/9943a774-c931-45ba-85df-aba06caa10ba

With Font directory

https://github.com/user-attachments/assets/0127b587-96a7-4969-aafe-6a7dee99214e

Trac ticket: #62633

#4 @abcd95
7 months ago

Test Report

Description

This report validates the indicated patch works as expected.

Environment

  • WordPress: 6.7.1
  • PHP: 8.1.29
  • Server: nginx/1.16.0
  • Database: mysqli (Server: 8.0.16 / Client: mysqlnd 8.1.29)
  • Browser: Chrome 131.0.0.0
  • OS: macOS
  • Theme: Twenty Twenty-Five 1.0

Actual Results

✅ Issue resolved with patch.

Supplemental Artifacts

Screenshots

Before: https://postimg.cc/cKsy44VW

After: https://postimg.cc/GBY8rzwV

#5 @ankitkumarshah
7 months ago

Test Report

Description

This report validates whether the indicated patch works as expected.

Environment

  • WordPress: 6.7.1
  • PHP: 8.1.29
  • Server: nginx/1.16.0
  • Database: mysqli (Server: 8.0.16 / Client: mysqlnd 8.1.29)
  • Browser: Chrome 131.0.0.0
  • OS: macOS
  • Theme: Twenty Twenty-Five 1.0
  • MU Plugins: None activated

Actual Results

  1. ✅ Issue resolved with patch.

Supplemental Artifacts

Before Patch

https://i.postimg.cc/ZJ5Jk41w/image.png

After patch

https://i.postimg.cc/Bv1GVZ7N/image.png

Last edited 7 months ago by ankitkumarshah (previous) (diff)

#6 @im3dabasia1
7 months ago

  • Keywords has-screenshots added

Reproduction Report

Description

This report validates whether the issue can be reproduced.

Environment

  • WordPress: 6.8-alpha-59274-src
  • PHP: 8.2.25
  • Server: nginx/1.27.2
  • Database: mysqli (Server: 8.0.40 / Client: mysqlnd 8.2.25)
  • Browser: Chrome 129.0.0.0
  • OS: macOS
  • Theme: Twenty Twenty-Five 1.0
  • MU Plugins: None activated
  • Plugins:
    • Test Reports 1.2.0

Actual Results

  1. ✅ Error condition occurs (reproduced).

Additional Notes

  • Any additional details worth mentioning.

Supplemental Artifacts

https://i.postimg.cc/13HHC6DD/Screenshot-2024-12-03-at-4-49-36-PM.png

Last edited 7 months ago by im3dabasia1 (previous) (diff)

#7 @im3dabasia1
7 months ago

  • Keywords has-testing-info added

Test Report

Description

This report validates whether the indicated patch works as expected.

Patch tested: https://github.com/WordPress/wordpress-develop/pull/7933.diff

Environment

  • WordPress: 6.8-alpha-59274-src
  • PHP: 8.2.25
  • Server: nginx/1.27.2
  • Database: mysqli (Server: 8.0.40 / Client: mysqlnd 8.2.25)
  • Browser: Chrome 129.0.0.0
  • OS: macOS
  • Theme: Twenty Twenty-Five 1.0
  • MU Plugins: None activated
  • Plugins:
    • Test Reports 1.2.0

Actual Results

  1. ✅ Issue resolved with patch.

Supplemental Artifacts

https://i.postimg.cc/cJLcVHc2/Screenshot-2024-12-03-at-4-51-57-PM.png

#8 @zodiac1978
4 months ago

Hey @sainathpoojary, thanks for the PR!

Just one thing: $is_fonts_dir_exist sounds a little bit wrong for me. I am not a native speaker, but $is_writable_fonts_dir sounds like an English sentence and $is_fonts_dir_exist does not.

Maybe just $fonts_dir_exists following the common naming convention?

@SergeyBiryukov There was one check failing, but I don't think this is in relation to the patch. Is this a known issue?
https://github.com/WordPress/wordpress-develop/pull/7933/commits/7f297db89e32fe5e12cca88468c1d549d5855722

#9 @sainathpoojary
4 months ago

Thanks for the feedback, @zodiac1978! I’ve updated the variable name to $fonts_dir_exists, Also all the checks are now passing. Please take a look whenever you have a moment.

#10 @zodiac1978
4 months ago

@sainathpoojary It looks like you have changed the wrong line.
$is_fonts_dir_exist should be $fonts_dir_exists

#11 @sainathpoojary
4 months ago

Thanks for catching that @zodiac1978! I’ve now corrected the variable rename to $fonts_dir_exists. Let me know if there’s anything else that needs adjusting.

This ticket was mentioned in Slack in #core by zodiac1978. View the logs.


4 months ago

#13 @audrasjb
4 months ago

  • Milestone changed from Awaiting Review to 6.8
  • Owner set to audrasjb
  • Status changed from new to accepted

#14 @audrasjb
4 months ago

  • Keywords commit added

I tested the PR it it looks great to me.

#15 @audrasjb
4 months ago

  • Resolution set to fixed
  • Status changed from accepted to closed

In 59853:

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.

#17 @wordpressdotorg
6 weeks ago

  • Keywords has-test-info added; has-testing-info removed
Note: See TracTickets for help on using tickets.