Site Health: Display the original PHP memory limit on Site Health Info screen.

This ensures that if the limit has been modified for admin screens by `wp_raise_memory_limit()`, the original value is displayed along with the current value.

Props Clorith, espiat, zodiac1978, SergeyBiryukov.
Fixes #49329.
Built from https://develop.svn.wordpress.org/trunk@47762


git-svn-id: http://core.svn.wordpress.org/trunk@47538 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Sergey Biryukov 2020-05-05 18:58:09 +00:00
parent b1a275684a
commit 9782eb82ad
3 changed files with 26 additions and 8 deletions

View File

@ -647,19 +647,32 @@ class WP_Debug_Data {
'label' => __( 'PHP time limit' ),
'value' => ini_get( 'max_execution_time' ),
);
$info['wp-server']['fields']['memory_limit'] = array(
'label' => __( 'PHP memory limit' ),
'value' => ini_get( 'memory_limit' ),
);
$info['wp-server']['fields']['max_input_time'] = array(
if ( WP_Site_Health::get_instance()->php_memory_limit !== ini_get( 'memory_limit' ) ) {
$info['wp-server']['fields']['memory_limit'] = array(
'label' => __( 'PHP memory limit' ),
'value' => WP_Site_Health::get_instance()->php_memory_limit,
);
$info['wp-server']['fields']['admin_memory_limit'] = array(
'label' => __( 'PHP memory limit (only for admin screens)' ),
'value' => ini_get( 'memory_limit' ),
);
} else {
$info['wp-server']['fields']['memory_limit'] = array(
'label' => __( 'PHP memory limit' ),
'value' => ini_get( 'memory_limit' ),
);
}
$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_size'] = 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' ),
);

View File

@ -18,6 +18,8 @@ class WP_Site_Health {
private $health_check_mysql_required_version = '5.5';
private $health_check_mysql_rec_version = '';
public $php_memory_limit;
public $schedules;
public $crons;
public $last_missed_cron = null;
@ -33,6 +35,9 @@ class WP_Site_Health {
public function __construct() {
$this->maybe_create_scheduled_event();
// Save memory limit before it's affected by wp_raise_memory_limit( 'admin' ).
$this->php_memory_limit = ini_get( 'memory_limit' );
$this->timeout_late_cron = 0;
$this->timeout_missed_cron = - 5 * MINUTE_IN_SECONDS;

View File

@ -13,7 +13,7 @@
*
* @global string $wp_version
*/
$wp_version = '5.5-alpha-47761';
$wp_version = '5.5-alpha-47762';
/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.