[wp-trac] [WordPress Trac] #61602: site health - disk_free_space return error

WordPress Trac noreply at wordpress.org
Tue Jul 9 19:56:05 UTC 2024


#61602: site health - disk_free_space return error
--------------------------+------------------------------
 Reporter:  wbdv          |       Owner:  (none)
     Type:  defect (bug)  |      Status:  new
 Priority:  normal        |   Milestone:  Awaiting Review
Component:  Site Health   |     Version:  6.5.5
 Severity:  minor         |  Resolution:
 Keywords:                |     Focuses:
--------------------------+------------------------------

Comment (by wbdv):

 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:


 {{{#!php
 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.

 {{{#!php
 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;

 }}}

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/61602#comment:2>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list