mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-04-04 12:44:31 +00:00
Site Health: Remove parse_ini_size(), use the existing wp_convert_hr_to_bytes() function instead.
Follow-up to [48535]. See #50038. git-svn-id: https://develop.svn.wordpress.org/trunk@48538 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
@@ -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.
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user