Changeset 48538
- Timestamp:
- 07/21/2020 03:38:40 PM (4 years ago)
- Location:
- trunk/src
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-admin/includes/class-wp-debug-data.php
r48535 r48538 535 535 $upload_max_size = ini_get( 'upload_max_filesize' ); 536 536 $max_file_uploads = ini_get( 'max_file_uploads' ); 537 $effective = min( parse_ini_size( $post_max_size ), parse_ini_size( $upload_max_size ) );537 $effective = min( wp_convert_hr_to_bytes( $post_max_size ), wp_convert_hr_to_bytes( $upload_max_size ) ); 538 538 539 539 // Add info in Media section. -
trunk/src/wp-admin/includes/class-wp-site-health.php
r48535 r48538 1957 1957 1958 1958 /** 1959 * Test if 'file_uploads' directive in PHP.ini is turned off 1959 * Test if 'file_uploads' directive in PHP.ini is turned off. 1960 1960 * 1961 1961 * @since 5.5.0 … … 2008 2008 } 2009 2009 2010 if ( parse_ini_size( ini_get( 'post_max_size' ) ) !== parse_ini_size( ini_get( 'upload_max_filesize' ) ) ) { 2010 $post_max_size = ini_get( 'post_max_size' ); 2011 $upload_max_size = ini_get( 'upload_max_filesize' ); 2012 2013 if ( wp_convert_hr_to_bytes( $post_max_size ) !== wp_convert_hr_to_bytes( $upload_max_size ) ) { 2011 2014 $result['label'] = __( 'Mismatched "post_max_size" and "upload_max_filesize" values.' ); 2012 2015 $result['status'] = 'recommended'; -
trunk/src/wp-includes/functions.php
r48535 r48538 475 475 476 476 return false; 477 }478 479 /**480 * Converts a shorthand byte string to bytes.481 *482 * Useful when needing to compare two byte strings for size differences.483 *484 * E.g.485 * "1G" (1 Gigabyte) = 1073741824486 * "10M" (10 Megabytes) = 10485760487 * "1K" (1 Kilobyte) = 1024488 *489 * @since 5.5.0490 *491 * @param string $size_string Shorthand byte string492 * @return int $size_string converted to numberic bytes.493 */494 function parse_ini_size( $size_string ) {495 $size_string = trim( $size_string );496 $last = strtolower( substr( $size_string, - 1 ) );497 $value = intval( $size_string );498 499 switch ( $last ) {500 case 'g':501 return (int) $value * GB_IN_BYTES;502 case 'm':503 return (int) $value * MB_IN_BYTES;504 case 'k':505 return (int) $value * KB_IN_BYTES;506 default:507 return (int) $value;508 }509 477 } 510 478
Note: See TracChangeset
for help on using the changeset viewer.