mirror of
https://github.com/WordPress/WordPress.git
synced 2024-12-23 01:27:36 +01:00
Site Health: Remove parse_ini_size()
, use the existing wp_convert_hr_to_bytes()
function instead.
Follow-up to [48535]. See #50038. Built from https://develop.svn.wordpress.org/trunk@48538 git-svn-id: http://core.svn.wordpress.org/trunk@48300 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
3dda74c337
commit
bec9fa5010
@ -534,7 +534,7 @@ class WP_Debug_Data {
|
||||
$post_max_size = ini_get( 'post_max_size' );
|
||||
$upload_max_size = ini_get( 'upload_max_filesize' );
|
||||
$max_file_uploads = ini_get( 'max_file_uploads' );
|
||||
$effective = min( parse_ini_size( $post_max_size ), parse_ini_size( $upload_max_size ) );
|
||||
$effective = min( wp_convert_hr_to_bytes( $post_max_size ), wp_convert_hr_to_bytes( $upload_max_size ) );
|
||||
|
||||
// Add info in Media section.
|
||||
$info['wp-media']['fields']['file_uploads'] = array(
|
||||
|
@ -1956,7 +1956,7 @@ class WP_Site_Health {
|
||||
}
|
||||
|
||||
/**
|
||||
* Test if 'file_uploads' directive in PHP.ini is turned off
|
||||
* Test if 'file_uploads' directive in PHP.ini is turned off.
|
||||
*
|
||||
* @since 5.5.0
|
||||
*
|
||||
@ -2007,7 +2007,10 @@ class WP_Site_Health {
|
||||
return $result;
|
||||
}
|
||||
|
||||
if ( parse_ini_size( ini_get( 'post_max_size' ) ) !== parse_ini_size( ini_get( 'upload_max_filesize' ) ) ) {
|
||||
$post_max_size = ini_get( 'post_max_size' );
|
||||
$upload_max_size = ini_get( 'upload_max_filesize' );
|
||||
|
||||
if ( wp_convert_hr_to_bytes( $post_max_size ) !== wp_convert_hr_to_bytes( $upload_max_size ) ) {
|
||||
$result['label'] = __( 'Mismatched "post_max_size" and "upload_max_filesize" values.' );
|
||||
$result['status'] = 'recommended';
|
||||
$result['description'] = sprintf(
|
||||
|
@ -476,38 +476,6 @@ function size_format( $bytes, $decimals = 0 ) {
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Converts a shorthand byte string to bytes.
|
||||
*
|
||||
* Useful when needing to compare two byte strings for size differences.
|
||||
*
|
||||
* E.g.
|
||||
* "1G" (1 Gigabyte) = 1073741824
|
||||
* "10M" (10 Megabytes) = 10485760
|
||||
* "1K" (1 Kilobyte) = 1024
|
||||
*
|
||||
* @since 5.5.0
|
||||
*
|
||||
* @param string $size_string Shorthand byte string
|
||||
* @return int $size_string converted to numberic bytes.
|
||||
*/
|
||||
function parse_ini_size( $size_string ) {
|
||||
$size_string = trim( $size_string );
|
||||
$last = strtolower( substr( $size_string, - 1 ) );
|
||||
$value = intval( $size_string );
|
||||
|
||||
switch ( $last ) {
|
||||
case 'g':
|
||||
return (int) $value * GB_IN_BYTES;
|
||||
case 'm':
|
||||
return (int) $value * MB_IN_BYTES;
|
||||
case 'k':
|
||||
return (int) $value * KB_IN_BYTES;
|
||||
default:
|
||||
return (int) $value;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert a duration to human readable format.
|
||||
*
|
||||
|
@ -13,7 +13,7 @@
|
||||
*
|
||||
* @global string $wp_version
|
||||
*/
|
||||
$wp_version = '5.5-beta2-48537';
|
||||
$wp_version = '5.5-beta2-48538';
|
||||
|
||||
/**
|
||||
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
||||
|
Loading…
Reference in New Issue
Block a user