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…'; |
| 3538 | |
| 3539 | await sleep(7000); |
| 3540 | |
| 3541 | // Show that the page is about to reload |
| 3542 | document.getElementById('refresh').innerHTML = 'Will reload soon…'; |
| 3543 | |
| 3544 | await sleep(3000); |
| 3545 | window.location.reload(true); |
| 3546 | } |
| 3547 | |
| 3548 | refreshAfterPause(); |
| 3549 | </script> |
| 3550 | <?php } else { |
| 3551 | echo $message; |
| 3552 | } ?> |