WordPress.org

Make WordPress Core

Changeset 47762


Ignore:
Timestamp:
05/05/2020 06:56:44 PM (17 months ago)
Author:
SergeyBiryukov
Message:

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.

Location:
trunk/src/wp-admin/includes
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-admin/includes/class-wp-debug-data.php

    r47527 r47762  
    648648                'value' => ini_get( 'max_execution_time' ),
    649649            );
    650             $info['wp-server']['fields']['memory_limit']        = array(
    651                 'label' => __( 'PHP memory limit' ),
    652                 'value' => ini_get( 'memory_limit' ),
    653             );
    654             $info['wp-server']['fields']['max_input_time']      = array(
     650
     651            if ( WP_Site_Health::get_instance()->php_memory_limit !== ini_get( 'memory_limit' ) ) {
     652                $info['wp-server']['fields']['memory_limit']       = array(
     653                    'label' => __( 'PHP memory limit' ),
     654                    'value' => WP_Site_Health::get_instance()->php_memory_limit,
     655                );
     656                $info['wp-server']['fields']['admin_memory_limit'] = array(
     657                    'label' => __( 'PHP memory limit (only for admin screens)' ),
     658                    'value' => ini_get( 'memory_limit' ),
     659                );
     660            } else {
     661                $info['wp-server']['fields']['memory_limit'] = array(
     662                    'label' => __( 'PHP memory limit' ),
     663                    'value' => ini_get( 'memory_limit' ),
     664                );
     665            }
     666
     667            $info['wp-server']['fields']['max_input_time']    = array(
    655668                'label' => __( 'Max input time' ),
    656669                'value' => ini_get( 'max_input_time' ),
    657670            );
    658             $info['wp-server']['fields']['upload_max_size']     = array(
     671            $info['wp-server']['fields']['upload_max_size']   = array(
    659672                'label' => __( 'Upload max filesize' ),
    660673                'value' => ini_get( 'upload_max_filesize' ),
    661674            );
    662             $info['wp-server']['fields']['php_post_max_size']   = array(
     675            $info['wp-server']['fields']['php_post_max_size'] = array(
    663676                'label' => __( 'PHP post max size' ),
    664677                'value' => ini_get( 'post_max_size' ),
  • trunk/src/wp-admin/includes/class-wp-site-health.php

    r47628 r47762  
    1919    private $health_check_mysql_rec_version      = '';
    2020
     21    public $php_memory_limit;
     22
    2123    public $schedules;
    2224    public $crons;
     
    3335    public function __construct() {
    3436        $this->maybe_create_scheduled_event();
     37
     38        // Save memory limit before it's affected by wp_raise_memory_limit( 'admin' ).
     39        $this->php_memory_limit = ini_get( 'memory_limit' );
    3540
    3641        $this->timeout_late_cron   = 0;
Note: See TracChangeset for help on using the changeset viewer.