From 260dd52af5c5dec7b60ef78ab41032b258f1feea Mon Sep 17 00:00:00 2001 From: Sergey Biryukov Date: Mon, 17 Aug 2020 01:29:03 +0000 Subject: [PATCH] Site Health: Only display the warning about the `post_max_size` PHP value when it's lower than `upload_max_filesize`. Previously, the warning was displayed even if the value was higher than `upload_max_filesize`, which made the report inaccurate, as these values don't necessarily have to match. Props oakesjosh, jeroenrotty, desrosj, Clorith. Merges [48800] and [48801] to the 5.5 branch. Fixes #50945. Built from https://develop.svn.wordpress.org/branches/5.5@48806 git-svn-id: http://core.svn.wordpress.org/branches/5.5@48568 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-admin/includes/class-wp-debug-data.php | 16 ++++++++-------- wp-admin/includes/class-wp-site-health.php | 10 +++++----- wp-includes/version.php | 2 +- 3 files changed, 14 insertions(+), 14 deletions(-) diff --git a/wp-admin/includes/class-wp-debug-data.php b/wp-admin/includes/class-wp-debug-data.php index 428fdb585d..7e21785cce 100644 --- a/wp-admin/includes/class-wp-debug-data.php +++ b/wp-admin/includes/class-wp-debug-data.php @@ -537,10 +537,10 @@ class WP_Debug_Data { ); } else { // Get the PHP ini directive values. - $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( wp_convert_hr_to_bytes( $post_max_size ), wp_convert_hr_to_bytes( $upload_max_size ) ); + $post_max_size = ini_get( 'post_max_size' ); + $upload_max_filesize = ini_get( 'upload_max_filesize' ); + $max_file_uploads = ini_get( 'max_file_uploads' ); + $effective = min( wp_convert_hr_to_bytes( $post_max_size ), wp_convert_hr_to_bytes( $upload_max_filesize ) ); // Add info in Media section. $info['wp-media']['fields']['file_uploads'] = array( @@ -554,7 +554,7 @@ class WP_Debug_Data { ); $info['wp-media']['fields']['upload_max_filesize'] = array( 'label' => __( 'Max size of an uploaded file' ), - 'value' => $upload_max_size, + 'value' => $upload_max_filesize, ); $info['wp-media']['fields']['max_effective_size'] = array( 'label' => __( 'Max effective file size' ), @@ -717,15 +717,15 @@ class WP_Debug_Data { ); } - $info['wp-server']['fields']['max_input_time'] = array( + $info['wp-server']['fields']['max_input_time'] = array( 'label' => __( 'Max input time' ), 'value' => ini_get( 'max_input_time' ), ); - $info['wp-server']['fields']['upload_max_size'] = array( + $info['wp-server']['fields']['upload_max_filesize'] = array( 'label' => __( 'Upload max filesize' ), 'value' => ini_get( 'upload_max_filesize' ), ); - $info['wp-server']['fields']['php_post_max_size'] = array( + $info['wp-server']['fields']['php_post_max_size'] = array( 'label' => __( 'PHP post max size' ), 'value' => ini_get( 'post_max_size' ), ); diff --git a/wp-admin/includes/class-wp-site-health.php b/wp-admin/includes/class-wp-site-health.php index c27a50a2ef..7743113e11 100644 --- a/wp-admin/includes/class-wp-site-health.php +++ b/wp-admin/includes/class-wp-site-health.php @@ -2046,13 +2046,13 @@ class WP_Site_Health { return $result; } - $post_max_size = ini_get( 'post_max_size' ); - $upload_max_size = ini_get( 'upload_max_filesize' ); + $post_max_size = ini_get( 'post_max_size' ); + $upload_max_filesize = ini_get( 'upload_max_filesize' ); - if ( wp_convert_hr_to_bytes( $post_max_size ) !== wp_convert_hr_to_bytes( $upload_max_size ) ) { + if ( wp_convert_hr_to_bytes( $post_max_size ) < wp_convert_hr_to_bytes( $upload_max_filesize ) ) { $result['label'] = sprintf( /* translators: 1: post_max_size, 2: upload_max_filesize */ - __( 'Mismatched "%1$s" and "%2$s" values.' ), + __( 'The "%1$s" value is smaller than "%2$s".' ), 'post_max_size', 'upload_max_filesize' ); @@ -2061,7 +2061,7 @@ class WP_Site_Health { '

%s

', sprintf( /* translators: 1: post_max_size, 2: upload_max_filesize */ - __( 'The settings for %1$s and %2$s are not the same, this could cause some problems when trying to upload files.' ), + __( 'The setting for %1$s is smaller than %2$s, this could cause some problems when trying to upload files.' ), 'post_max_size', 'upload_max_filesize' ) diff --git a/wp-includes/version.php b/wp-includes/version.php index d3ba9569d3..08cdad1546 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -13,7 +13,7 @@ * * @global string $wp_version */ -$wp_version = '5.5.1-alpha-48805'; +$wp_version = '5.5.1-alpha-48806'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.