Skip to content

Commit c3f87f4

Browse files
authored
Merge branch 'WordPress:trunk' into trunk
2 parents 07bfe37 + ec8b004 commit c3f87f4

3 files changed

Lines changed: 63 additions & 105 deletions

File tree

src/wp-admin/includes/class-wp-debug-data.php

Lines changed: 62 additions & 89 deletions
Original file line numberDiff line numberDiff line change
@@ -387,57 +387,44 @@ private static function get_wp_server(): array {
387387
'debug' => PHP_SAPI,
388388
);
389389

390-
// Some servers disable `ini_set()` and `ini_get()`, we check this before trying to get configuration values.
391-
if ( ! function_exists( 'ini_get' ) ) {
392-
$fields['ini_get'] = array(
393-
'label' => __( 'Server settings' ),
394-
'value' => sprintf(
395-
/* translators: %s: ini_get() */
396-
__( 'Unable to determine some settings, as the %s function has been disabled.' ),
397-
'ini_get()'
398-
),
399-
'debug' => 'ini_get() is disabled',
400-
);
401-
} else {
402-
$fields['max_input_variables'] = array(
403-
'label' => __( 'PHP max input variables' ),
404-
'value' => ini_get( 'max_input_vars' ),
405-
);
406-
$fields['time_limit'] = array(
407-
'label' => __( 'PHP time limit' ),
408-
'value' => ini_get( 'max_execution_time' ),
409-
);
410-
411-
if ( WP_Site_Health::get_instance()->php_memory_limit !== ini_get( 'memory_limit' ) ) {
412-
$fields['memory_limit'] = array(
413-
'label' => __( 'PHP memory limit' ),
414-
'value' => WP_Site_Health::get_instance()->php_memory_limit,
415-
);
416-
$fields['admin_memory_limit'] = array(
417-
'label' => __( 'PHP memory limit (only for admin screens)' ),
418-
'value' => ini_get( 'memory_limit' ),
419-
);
420-
} else {
421-
$fields['memory_limit'] = array(
422-
'label' => __( 'PHP memory limit' ),
423-
'value' => ini_get( 'memory_limit' ),
424-
);
425-
}
390+
$fields['max_input_variables'] = array(
391+
'label' => __( 'PHP max input variables' ),
392+
'value' => ini_get( 'max_input_vars' ),
393+
);
394+
$fields['time_limit'] = array(
395+
'label' => __( 'PHP time limit' ),
396+
'value' => ini_get( 'max_execution_time' ),
397+
);
426398

427-
$fields['max_input_time'] = array(
428-
'label' => __( 'Max input time' ),
429-
'value' => ini_get( 'max_input_time' ),
399+
if ( WP_Site_Health::get_instance()->php_memory_limit !== ini_get( 'memory_limit' ) ) {
400+
$fields['memory_limit'] = array(
401+
'label' => __( 'PHP memory limit' ),
402+
'value' => WP_Site_Health::get_instance()->php_memory_limit,
430403
);
431-
$fields['upload_max_filesize'] = array(
432-
'label' => __( 'Upload max filesize' ),
433-
'value' => ini_get( 'upload_max_filesize' ),
404+
$fields['admin_memory_limit'] = array(
405+
'label' => __( 'PHP memory limit (only for admin screens)' ),
406+
'value' => ini_get( 'memory_limit' ),
434407
);
435-
$fields['php_post_max_size'] = array(
436-
'label' => __( 'PHP post max size' ),
437-
'value' => ini_get( 'post_max_size' ),
408+
} else {
409+
$fields['memory_limit'] = array(
410+
'label' => __( 'PHP memory limit' ),
411+
'value' => ini_get( 'memory_limit' ),
438412
);
439413
}
440414

415+
$fields['max_input_time'] = array(
416+
'label' => __( 'Max input time' ),
417+
'value' => ini_get( 'max_input_time' ),
418+
);
419+
$fields['upload_max_filesize'] = array(
420+
'label' => __( 'Upload max filesize' ),
421+
'value' => ini_get( 'upload_max_filesize' ),
422+
);
423+
$fields['php_post_max_size'] = array(
424+
'label' => __( 'PHP post max size' ),
425+
'value' => ini_get( 'post_max_size' ),
426+
);
427+
441428
if ( function_exists( 'curl_version' ) ) {
442429
$curl = curl_version();
443430

@@ -676,47 +663,35 @@ private static function get_wp_media(): array {
676663
'value' => ( $imagick_version ) ? $imagick_version : __( 'Not available' ),
677664
);
678665

679-
if ( ! function_exists( 'ini_get' ) ) {
680-
$fields['ini_get'] = array(
681-
'label' => __( 'File upload settings' ),
682-
'value' => sprintf(
683-
/* translators: %s: ini_get() */
684-
__( 'Unable to determine some settings, as the %s function has been disabled.' ),
685-
'ini_get()'
686-
),
687-
'debug' => 'ini_get() is disabled',
688-
);
689-
} else {
690-
// Get the PHP ini directive values.
691-
$file_uploads = ini_get( 'file_uploads' );
692-
$post_max_size = ini_get( 'post_max_size' );
693-
$upload_max_filesize = ini_get( 'upload_max_filesize' );
694-
$max_file_uploads = ini_get( 'max_file_uploads' );
695-
$effective = min( wp_convert_hr_to_bytes( $post_max_size ), wp_convert_hr_to_bytes( $upload_max_filesize ) );
696-
697-
// Add info in Media section.
698-
$fields['file_uploads'] = array(
699-
'label' => __( 'File uploads' ),
700-
'value' => $file_uploads ? __( 'Enabled' ) : __( 'Disabled' ),
701-
'debug' => $file_uploads,
702-
);
703-
$fields['post_max_size'] = array(
704-
'label' => __( 'Max size of post data allowed' ),
705-
'value' => $post_max_size,
706-
);
707-
$fields['upload_max_filesize'] = array(
708-
'label' => __( 'Max size of an uploaded file' ),
709-
'value' => $upload_max_filesize,
710-
);
711-
$fields['max_effective_size'] = array(
712-
'label' => __( 'Max effective file size' ),
713-
'value' => size_format( $effective ),
714-
);
715-
$fields['max_file_uploads'] = array(
716-
'label' => __( 'Max simultaneous file uploads' ),
717-
'value' => $max_file_uploads,
718-
);
719-
}
666+
// Get the PHP ini directive values.
667+
$file_uploads = ini_get( 'file_uploads' );
668+
$post_max_size = ini_get( 'post_max_size' );
669+
$upload_max_filesize = ini_get( 'upload_max_filesize' );
670+
$max_file_uploads = ini_get( 'max_file_uploads' );
671+
$effective = min( wp_convert_hr_to_bytes( $post_max_size ), wp_convert_hr_to_bytes( $upload_max_filesize ) );
672+
673+
// Add info in Media section.
674+
$fields['file_uploads'] = array(
675+
'label' => __( 'File uploads' ),
676+
'value' => $file_uploads ? __( 'Enabled' ) : __( 'Disabled' ),
677+
'debug' => $file_uploads,
678+
);
679+
$fields['post_max_size'] = array(
680+
'label' => __( 'Max size of post data allowed' ),
681+
'value' => $post_max_size,
682+
);
683+
$fields['upload_max_filesize'] = array(
684+
'label' => __( 'Max size of an uploaded file' ),
685+
'value' => $upload_max_filesize,
686+
);
687+
$fields['max_effective_size'] = array(
688+
'label' => __( 'Max effective file size' ),
689+
'value' => size_format( $effective ),
690+
);
691+
$fields['max_file_uploads'] = array(
692+
'label' => __( 'Max simultaneous file uploads' ),
693+
'value' => $max_file_uploads,
694+
);
720695

721696
// If Imagick is used as our editor, provide some more information about its limitations.
722697
if ( 'WP_Image_Editor_Imagick' === _wp_image_editor_choose() && isset( $imagick ) && $imagick instanceof Imagick ) {
@@ -1977,9 +1952,7 @@ public static function get_sizes() {
19771952
* from causing a timeout. The default value is 30 seconds, and some
19781953
* hosts do not allow you to read configuration values.
19791954
*/
1980-
if ( function_exists( 'ini_get' ) ) {
1981-
$max_execution_time = ini_get( 'max_execution_time' );
1982-
}
1955+
$max_execution_time = ini_get( 'max_execution_time' );
19831956

19841957
/*
19851958
* The max_execution_time defaults to 0 when PHP runs from cli.

src/wp-admin/includes/class-wp-site-health.php

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2322,16 +2322,6 @@ public function get_test_file_uploads() {
23222322
'test' => 'file_uploads',
23232323
);
23242324

2325-
if ( ! function_exists( 'ini_get' ) ) {
2326-
$result['status'] = 'critical';
2327-
$result['description'] .= sprintf(
2328-
/* translators: %s: ini_get() */
2329-
__( 'The %s function has been disabled, some media settings are unavailable because of this.' ),
2330-
'<code>ini_get()</code>'
2331-
);
2332-
return $result;
2333-
}
2334-
23352325
if ( empty( ini_get( 'file_uploads' ) ) ) {
23362326
$result['status'] = 'critical';
23372327
$result['description'] .= sprintf(

src/wp-includes/functions.php

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8878,12 +8878,7 @@ function recurse_dirsize( $directory, $exclude = null, $max_execution_time = nul
88788878

88798879
if ( null === $max_execution_time ) {
88808880
// Keep the previous behavior but attempt to prevent fatal errors from timeout if possible.
8881-
if ( function_exists( 'ini_get' ) ) {
8882-
$max_execution_time = ini_get( 'max_execution_time' );
8883-
} else {
8884-
// Disable...
8885-
$max_execution_time = 0;
8886-
}
8881+
$max_execution_time = ini_get( 'max_execution_time' );
88878882

88888883
// Leave 1 second "buffer" for other operations if $max_execution_time has reasonable value.
88898884
if ( $max_execution_time > 10 ) {

0 commit comments

Comments
 (0)