Tests available disk space for updates.
Source
public function get_test_available_updates_disk_space() {
$available_space = function_exists( 'disk_free_space' ) ? @disk_free_space( WP_CONTENT_DIR ) : false;
$result = array(
'label' => __( 'Disk space available to safely perform updates' ),
'status' => 'good',
'badge' => array(
'label' => __( 'Security' ),
'color' => 'blue',
),
'description' => sprintf(
/* translators: %s: Available disk space in MB or GB. */
'<p>' . __( '%s available disk space was detected, update routines can be performed safely.' ) . '</p>',
size_format( $available_space )
),
'actions' => '',
'test' => 'available_updates_disk_space',
);
if ( false === $available_space ) {
$result['description'] = __( 'Could not determine available disk space for updates.' );
$result['status'] = 'recommended';
} elseif ( $available_space < 20 * MB_IN_BYTES ) {
$result['description'] = sprintf(
/* translators: %s: Available disk space in MB or GB. */
__( 'Available disk space is critically low, less than %s available. Proceed with caution, updates may fail.' ),
size_format( 20 * MB_IN_BYTES )
);
$result['status'] = 'critical';
} elseif ( $available_space < 100 * MB_IN_BYTES ) {
$result['description'] = sprintf(
/* translators: %s: Available disk space in MB or GB. */
__( 'Available disk space is low, less than %s available.' ),
size_format( 100 * MB_IN_BYTES )
);
$result['status'] = 'recommended';
}
return $result;
}
Changelog
Version | Description |
---|---|
6.3.0 | Introduced. |
User Contributed Notes
You must log in before being able to contribute a note or feedback.