Make WordPress Core

Opened 8 months ago

Closed 8 months ago

Last modified 7 months ago

#61736 closed defect (bug) (duplicate)

WP Site Health doesn't work if `wp-content/uploads/fonts` directory doesn't exist

Reported by: jkmassel's profile jkmassel Owned by:
Milestone: Priority: normal
Severity: normal Version: 6.7
Component: Site Health Keywords: has-testing-info has-patch
Focuses: Cc:

Description

Related to #60719 and https://github.com/WordPress/wordpress-develop/pull/6260.

As noted in https://wordpress.org/support/topic/wordpress-6-6-query-to-directory-sizes-of-wp-site-health-json-returns-500-error/, the API returns a 500 error if wp-content/uploads/fonts doesn't exist (because it thinks it can't reliably determine the size of the WordPress installation without access to that directory).

We're already checking the overall size of uploads_size, so IINM we're also double-counting the size of any included fonts.

Attachments (2)

Screenshot 2024-07-23 at 8.16.00 PM.png (165.3 KB) - added by jkmassel 8 months ago.
Clean install of WordPress (using the latest docker image) – size values never load, web console shows HTTP 500 errors
Screenshot 2024-07-23 at 8.16.27 PM.png (160.2 KB) - added by jkmassel 8 months ago.
After creating the wp-content/uploads/fonts directory within the docker image the values load immediately

Download all attachments as: .zip

Change History (7)

@jkmassel
8 months ago

Clean install of WordPress (using the latest docker image) – size values never load, web console shows HTTP 500 errors

@jkmassel
8 months ago

After creating the wp-content/uploads/fonts directory within the docker image the values load immediately

#1 @jkmassel
8 months ago

Before creating wp-content/uploads/fonts:

curl "http://localhost/wp-json/wp-site-health/v1/directory-sizes" -u 'test@example.com:[redacted]'
{"code":"not_available","message":"Directory sizes could not be returned.","data":{"status":500}}                                                                                                                                                                                                                        

After creating wp-content/uploads/fonts:

curl "http://localhost/wp-json/wp-site-health/v1/directory-sizes" -u 'test@example.com:[redacted]'
{"raw":0,"wordpress_size":{"size":"55.37 MB","debug":"55.37 MB (58060516 bytes)","raw":58060516},"themes_size":{"size":"12.12 MB","debug":"12.12 MB (12706752 bytes)","raw":12706752},"plugins_size":{"size":"395.35 KB","debug":"395.35 KB (404836 bytes)","raw":404836},"uploads_size":{"size":"44.87 MB","debug":"44.87 MB (47044510 bytes)","raw":47044510},"fonts_size":{"size":"0.00 B","debug":"0.00 B (0 bytes)"},"database_size":{"size":"3.34 MB","debug":"3.34 MB (3506176 bytes)","raw":3506176},"total_size":{"size":"116.08 MB","debug":"116.08 MB (121722790 bytes)","raw":121722790}}                                              

#2 @narenin
8 months ago

  • Keywords has-testing-info added
  • Severity changed from normal to major

Hi,

I have also try to replicate the issue and it is showing the same behavior at my end.

Environment

WordPress: 6.6.1
PHP: 8.1.23
Server: nginx/1.16.0
Database: mysqli (Server: 8.0.16 / Client: mysqlnd 8.1.23)
Browser: Chrome 126.0.0.0 (macOS)
Theme: Twenty Nineteen 2.8

Also this is happening because if we are getting 'not available' value for the given variable

$all_sizes['total_size']['debug']

then we are passing status 500 in API response due to which all data related to directory showing 'loading...' while it should show only 'loading...' for only directory which does not has data.

API URL : https://site-url/wp-json/wp-site-health/v1/directory-sizes

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


8 months ago
#3

  • Keywords has-patch added

#4 @swissspidy
8 months ago

  • Milestone Awaiting Review deleted
  • Resolution set to duplicate
  • Severity changed from major to normal
  • Status changed from new to closed

This is already being tracked in #61638

Note: See TracTickets for help on using tickets.