Changeset 45111
- Timestamp:
- 04/04/2019 09:53:45 PM (7 years ago)
- Location:
- trunk/src
- Files:
-
- 2 edited
-
wp-admin/includes/class-wp-debug-data.php (modified) (3 diffs)
-
wp-includes/functions.php (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-admin/includes/class-wp-debug-data.php
r45110 r45111 318 318 * hosts do not allow you to read configuration values. 319 319 */ 320 $max_execution_time = 30;321 322 320 if ( function_exists( 'ini_get' ) ) { 323 321 $max_execution_time = ini_get( 'max_execution_time' ); 322 } 323 324 // The max_execution_time defaults to 0 when PHP runs from cli. 325 // We still want to limit it below. 326 if ( empty( $max_execution_time ) ) { 327 $max_execution_time = 30; 324 328 } 325 329 … … 329 333 if ( $max_execution_time > 20 ) { 330 334 $max_execution_time = 20; 331 } elseif ( $max_execution_time > 2) {335 } elseif ( $max_execution_time > 10 ) { 332 336 // If the max_execution_time is set to lower than 20 seconds, reduce it a bit to prevent 333 337 // edge-case timeouts that may happen after the size loop has finished running. … … 368 372 369 373 if ( $dir_size === false ) { 370 // Error reading 371 $dir_size = $inaccessible; 374 // Error reading. 375 $dir_size = $inaccessible; 376 // Stop total size calculation. 372 377 $size_total = null; 373 378 } elseif ( $dir_size === null ) { 374 // Timeout 375 $dir_size = $timeout; 379 // Timeout. 380 $dir_size = $timeout; 381 // Stop total size calculation. 376 382 $size_total = null; 377 383 } else { -
trunk/src/wp-includes/functions.php
r45104 r45111 7015 7015 * 7016 7016 * @since MU (3.0.0) 7017 * @since 5.2.0 $max_execution_time parameter added. 7017 7018 * 7018 7019 * @param string $directory Full path of a directory. … … 7052 7053 * @since MU (3.0.0) 7053 7054 * @since 4.3.0 $exclude parameter added. 7055 * @since 5.2.0 $max_execution_time parameter added. 7054 7056 * 7055 7057 * @param string $directory Full path of a directory. … … 7068 7070 } 7069 7071 7070 if ( ! $max_execution_time) {7071 // Keep the previous behavior but attempt to prevent fatal errors from timeout .7072 if ( $max_execution_time === null ) { 7073 // Keep the previous behavior but attempt to prevent fatal errors from timeout if possible. 7072 7074 if ( function_exists( 'ini_get' ) ) { 7073 7075 $max_execution_time = ini_get( 'max_execution_time' ); 7074 7076 } else { 7075 // Use PHP default.7076 $max_execution_time = 30;7077 // Disable... 7078 $max_execution_time = 0; 7077 7079 } 7078 7080 … … 7096 7098 } 7097 7099 7098 if ( microtime( true ) - WP_START_TIMESTAMP > $max_execution_time ) {7100 if ( $max_execution_time > 0 && microtime( true ) - WP_START_TIMESTAMP > $max_execution_time ) { 7099 7101 // Time exceeded. Give up instead of risking a fatal timeout. 7100 7102 $size = null;
Note: See TracChangeset
for help on using the changeset viewer.