Make WordPress Core

Ticket #48937: 48937.diff

File 48937.diff, 1.9 KB (added by apieschel, 5 years ago)

patch that implements proposed solution by checking for maintenance mode in the _default_wp_die_handler() function

  • src/wp-includes/functions.php

     
    35113511        </style>
    35123512</head>
    35133513<body id="error-page">
    3514 <?php endif; // ! did_action( 'admin_head' ) ?>
    3515         <?php echo $message; ?>
     3514<?php endif; // ! did_action( 'admin_head' )
     3515
     3516        global $upgrading;
     3517        // Check if in maintenance mode for automatic page reload
     3518        if( ( time() - $upgrading ) <= 600 ) { ?>
     3519                <div class="wp-die-message">
     3520                        <p><?php echo $message; ?></p>
     3521                        <p id="reload">Please try again in a minute.</p>
     3522                        <p>Thank you for your patience.</p>
     3523                        <p id="refresh"></p>
     3524                </div>
     3525
     3526                <script type='text/javascript'>
     3527                        function sleep( ms ) {
     3528                                return new Promise( resolve => setTimeout( resolve, ms ) );
     3529                        }
     3530
     3531                        async function refreshAfterPause() {
     3532                                // Pause to allow the page to fully load.
     3533                                await sleep(100);
     3534
     3535                                // Fill the relevant prompts, only if Javascript is enabled.
     3536                                document.getElementById('reload').innerHTML = 'This page will automatically reload every ten seconds.';
     3537                                document.getElementById('refresh').innerHTML = 'Waiting&hellip;';
     3538
     3539                                await sleep(7000);
     3540
     3541                                // Show that the page is about to reload
     3542                                document.getElementById('refresh').innerHTML = 'Will reload soon&hellip;';
     3543
     3544                                await sleep(3000);                     
     3545                                window.location.reload(true);
     3546                        }
     3547
     3548                        refreshAfterPause();
     3549                </script>
     3550        <?php } else {
     3551                echo $message;
     3552        } ?>
    35163553</body>
    35173554</html>
    35183555        <?php
  • src/wp-includes/load.php

     
    226226        header( 'Retry-After: 600' );
    227227
    228228        wp_die(
    229                 __( 'Briefly unavailable for scheduled maintenance. Check back in a minute.' ),
     229                __( 'Briefly unavailable for scheduled maintenance.' ),
    230230                __( 'Maintenance' ),
    231231                503
    232232        );