Make WordPress Core


Ignore:
Timestamp:
04/04/2019 09:53:45 PM (7 years ago)
Author:
azaozz
Message:

Site health: fix usage of max_execution_time. When PHP is run from the cli the default is 0.

Fixes #46645.

File:
1 edited

Legend:

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

    r45110 r45111  
    318318         * hosts do not allow you to read configuration values.
    319319         */
    320         $max_execution_time = 30;
    321 
    322320        if ( function_exists( 'ini_get' ) ) {
    323321            $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;
    324328        }
    325329
     
    329333        if ( $max_execution_time > 20 ) {
    330334            $max_execution_time = 20;
    331         } elseif ( $max_execution_time > 2 ) {
     335        } elseif ( $max_execution_time > 10 ) {
    332336            // If the max_execution_time is set to lower than 20 seconds, reduce it a bit to prevent
    333337            // edge-case timeouts that may happen after the size loop has finished running.
     
    368372
    369373            if ( $dir_size === false ) {
    370                 // Error reading
    371                 $dir_size   = $inaccessible;
     374                // Error reading.
     375                $dir_size = $inaccessible;
     376                // Stop total size calculation.
    372377                $size_total = null;
    373378            } elseif ( $dir_size === null ) {
    374                 // Timeout
    375                 $dir_size   = $timeout;
     379                // Timeout.
     380                $dir_size = $timeout;
     381                // Stop total size calculation.
    376382                $size_total = null;
    377383            } else {
Note: See TracChangeset for help on using the changeset viewer.