[wp-trac] [WordPress Trac] #48937: Auto-refresh maintenance mode screen

WordPress Trac noreply at wordpress.org
Tue Jan 14 22:04:19 UTC 2020


#48937: Auto-refresh maintenance mode screen
--------------------------------------+-----------------------------
 Reporter:  Paddy Landau              |       Owner:  (none)
     Type:  enhancement               |      Status:  new
 Priority:  normal                    |   Milestone:  Future Release
Component:  Upgrade/Install           |     Version:
 Severity:  normal                    |  Resolution:
 Keywords:  good-first-bug has-patch  |     Focuses:  ui
--------------------------------------+-----------------------------

Comment (by apieschel):

 I have added a patch that implements a slightly modified version of
 @paddy-landau 's original solution with the i18n functions. Since the
 maintenance mode HTML is displayed as a result of the wp_die() function
 being called, my original inclination was to modify wp_die() to check for
 maintenance mode and add a new custom _maintenance_wp_die_handler() in wp-
 includes/functions.php. However, this resulted in a lot of duplicate code,
 so I added the check to the _default_wp_die_handler() instead.

 If anyone thinks I should add the custom die handler instead of modifying
 the default handler, or if I should do something completely different,
 please let me know!

 For the check-for-maintenance-mode itself, I imitated the check in the
 wp_maintenance() function in wp-includes/load.php, which uses the global
 $upgrading variable to check for maintenance mode:

 {{{
 // If the $upgrading timestamp is older than 10 minutes, don't die.
 if ( ( time() - $upgrading ) >= 600 ) {
         return;
 }
 }}}

 The proposed patch does the reverse: check if the timestamp is younger
 than 10 minutes, and if so, then it echoes the new markup and script.

 I am very new to this, so any feedback/alternate approaches would be
 greatly appreciated!

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/48937#comment:3>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list