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.

git-svn-id: https://develop.svn.wordpress.org/trunk@47762 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Sergey Biryukov 2020-05-05 18:56:44 +00:00
parent 0206900cff
commit b19c56b736
2 changed files with 25 additions and 7 deletions

View File

@ -647,10 +647,23 @@ class WP_Debug_Data {
'label' => __( 'PHP time limit' ),
'value' => ini_get( 'max_execution_time' ),
);
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' ),

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;