#61602 closed defect (bug) (fixed)
site health - disk_free_space return error
Reported by: | wbdv | Owned by: | SergeyBiryukov |
---|---|---|---|
Milestone: | 6.7 | Priority: | normal |
Severity: | minor | Version: | 6.5.5 |
Component: | Site Health | Keywords: | has-patch |
Focuses: | Cc: |
Description
disk_free_space return error if there is no directory WP_CONTENT_DIR . '/upgrade/' (and by default, there is no wp-contents/upgrade directory)
Function return false and site health give an error about disk space.
Solution is simple, try to create directory WP_CONTENT_DIR.'/upgrade/' before disk_free_space.
Change History (6)
#2
@
6 months ago
As you said, if wp-content/upgrade/ directory does not exists, disk_free_space() will return false. But this false means an error message in site health section of WordPress:
file: wp-admin/includes/class-wp-site-health.php line: 1952 <?php if ( false === $available_space ) { $result['description'] = __( 'Could not determine available disk space for updates.' ); $result['status'] = 'recommended';
To avoid this message, first try to create the wp-content/upgrade/ then check the disk free space. By default, wp-content/upgrade/ does not exists in wordpress (latest) and it needs to be created.
file: wp-admin/includes/class-wp-site-health.php line: 1933 <?php public function get_test_available_updates_disk_space() { + global $wp_filesystem; + $wp_filesystem->mkdir( WP_CONTENT_DIR . '/upgrade/', FS_CHMOD_DIR ); $available_space = function_exists( 'disk_free_space' ) ? @disk_free_space( WP_CONTENT_DIR . '/upgrade/' ) : false;
This ticket was mentioned in PR #7006 on WordPress/wordpress-develop by @khokansardar.
6 months ago
#3
- Keywords has-patch added
Trac ticket: https://core.trac.wordpress.org/ticket/61602
#4
@
4 months ago
- Owner set to SergeyBiryukov
- Resolution set to fixed
- Status changed from new to closed
In 58913:
@SergeyBiryukov commented on PR #7006:
4 months ago
#6
Thanks for the PR! Merged a slightly different approach in r58913.
I tested this but could not replicate the issue. The
disk_free_space
function is suppressed and returns false on failure.If you could tell us what is your environment like PHP version and WP version, that will help use replicate the issue.