Make WordPress Core

Ticket #18826: 18826.diff

File 18826.diff, 2.0 KB (added by dd32, 11 years ago)
  • src/wp-admin/includes/class-wp-upgrader.php

     
    347347                if ( $enable ) {
    348348                        $this->skin->feedback('maintenance_start');
    349349                        // Create maintenance file to signal that we are upgrading
    350                         $maintenance_string = '<?php $upgrading = ' . time() . '; ?>';
     350                        $timeout = apply_filters( 'upgrader_maintenance_mode_timeout', 600 );
     351                        $maintenance_string = '<?php $upgrading = ' . time() . '; $timeout = '  . intval( $timeout ) . '; ?>';
    351352                        $wp_filesystem->delete($file);
    352353                        $wp_filesystem->put_contents($file, $maintenance_string, FS_CHMOD_FILE);
    353354                } else if ( !$enable && $wp_filesystem->exists($file) ) {
  • src/wp-includes/load.php

     
    145145        if ( !file_exists( ABSPATH . '.maintenance' ) || defined( 'WP_INSTALLING' ) )
    146146                return;
    147147
    148         global $upgrading;
     148        global $upgrading, $timeout;
    149149
    150150        include( ABSPATH . '.maintenance' );
    151         // If the $upgrading timestamp is older than 10 minutes, don't die.
    152         if ( ( time() - $upgrading ) >= 600 )
     151
     152        if ( empty( $timeout ) )
     153                $timeout = 600; // Default of Ten minutes maximum for maintenance mode, overridden in .maintenance
     154
     155        // If the $upgrading timestamp is older than $timeout seconds, don't die.
     156        if ( ( time() - $upgrading ) >= $timeout )
    153157                return;
    154158
    155159        if ( file_exists( WP_CONTENT_DIR . '/maintenance.php' ) ) {
     
    164168                $protocol = 'HTTP/1.0';
    165169        header( "$protocol 503 Service Unavailable", true, 503 );
    166170        header( 'Content-Type: text/html; charset=utf-8' );
    167         header( 'Retry-After: 600' );
     171        header( 'Retry-After: ' . $timeout );
    168172?>
    169173        <!DOCTYPE html>
    170174        <html xmlns="http://www.w3.org/1999/xhtml"<?php if ( is_rtl() ) echo ' dir="rtl"'; ?>>