[wp-trac] [WordPress Trac] #40364: Improve site creation in multisite

WordPress Trac noreply at wordpress.org
Tue Jul 10 20:48:26 UTC 2018


#40364: Improve site creation in multisite
-------------------------------------------------+------------------------
 Reporter:  jeremyfelt                           |       Owner:  flixos90
     Type:  enhancement                          |      Status:  assigned
 Priority:  normal                               |   Milestone:  5.0
Component:  Networks and Sites                   |     Version:
 Severity:  normal                               |  Resolution:
 Keywords:  ms-roadmap has-patch has-unit-tests  |     Focuses:  multisite
-------------------------------------------------+------------------------

Comment (by flixos90):

 [attachment:"40364.11.diff"] implements recently suggested changes, plus a
 bit more:

 * `wp_normalize_site_data()` is now correctly added as a hook via
 `add_filter()`.
 * `wp_normalize_site_data()` now casts site status fields to integer
 values.
 * `wp_normalize_site_data()` now strips empty-ish date fields
 (`registered` and `last_updated`), as a date should always be present.
 Stripping the values out at this early point will ensure the default
 values (current time / previous time values) are used.
 * `wp_validate_site_data()` now ensures that `registered` and
 `last_updated` are always provided and valid (via `wp_checkdate()`).
 * `current_time( 'mysql', true )` is now used for generating MySQL date
 values, since we should always use GMT here, as otherwise the value would
 depend "randomly" on the current site (usually the main site) and its
 timezone settings, which is unexpected. A general format (i.e. GMT) should
 be used instead. Up to this point, only `last_updated` used GMT while
 `registered` used a localized time which doesn't make any sense. They need
 to have the same format.
 * New tests have been added for all of the above.

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


More information about the wp-trac mailing list