[wp-trac] [WordPress Trac] #49959: Introduce a new helper function to check if WordPress is currently in maintenance mode

WordPress Trac noreply at wordpress.org
Mon Apr 20 11:02:39 UTC 2020


#49959: Introduce a new helper function to check if WordPress is currently in
maintenance mode
-----------------------------+-----------------------------
 Reporter:  Clorith          |      Owner:  (none)
     Type:  enhancement      |     Status:  new
 Priority:  normal           |  Milestone:  Awaiting Review
Component:  Upgrade/Install  |    Version:  3.0
 Severity:  normal           |   Keywords:
  Focuses:                   |
-----------------------------+-----------------------------
 Initially thought of as `wp_is_updating()`, but as I've spent some time
 considering this, maintenance mode is used by various plugins as well, so
 it seems reasonable to instead go with something along the lines of
 `wp_is_maintenance_mode()`, returning a boolean to indicate if maintenance
 mode is enabled or not.

 Currently core only checks for maintenance mode in a single location, in
 the [https://github.com/WordPress/wordpress-
 develop/blob/5d5e3439e487ab157660cb48e57f3acd81a308a2/src/wp-
 includes/load.php#L188 `wp_maintenance()`] function, used to stop
 processing if maintenance is ongoing.

 With #48964 also looking to check if maintenance mode is enabled, it makes
 sense to split this out, both for core, but also for potential maintenance
 plugins.

 The most direct route would be to take parts of the existing function, and
 make that the new helper, specifically [https://github.com/WordPress
 /wordpress-develop/blob/5d5e3439e487ab157660cb48e57f3acd81a308a2/src/wp-
 includes/load.php#L189-L216 lines 189-216].

 The big question really is, what would such a function be named, to easily
 convey intent.

 For completeness sake, there is already a `wp_installing()` boolean check,
 which looks for the setup constants. With the existing function being
 there wit ha similar name, it seemed more appropriate to give the new one
 a slightly more descriptive function name.

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/49959>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list