Make WordPress Core

Opened 12 months ago

Last modified 8 months ago

#41064 new defect (bug)

Registered and last edited dates on new sites should be identical

Reported by: desrosj Owned by:
Milestone: Awaiting Review Priority: normal
Severity: normal Version:
Component: Networks and Sites Keywords: needs-patch needs-unit-tests
Focuses: multisite Cc:


In testing #40035, I discovered that depending on how long the creation process takes for a new site, the last updated and registered date could be different by up to several seconds. Ideally, this should always be identical when a new site is created.

Besides it potentially being confusing to a user, I have two use cases for this.

  1. It is impossible to write a test for #40035 without these dates being guaranteed the same.
  2. A good way to identify sites that were abandoned after creation would be to compare the registered and last updated dates. If these are not guaranteed to be the same this would become more difficult.

Change History (3)

#1 @nnikolov
11 months ago

Yes it will be good for the registered and last updated to be the same on creation. Maybe this could be done via the action hook wpmu_new_blog, that fires immediately after a new site is created. At this point we could change one of them to be the same as the other one.

(On related note, maybe the first default post, page, and comment, should also have the same exact time as site registered and updated on creation).

This ticket was mentioned in Slack in #core-multisite by desrosj. View the logs.

8 months ago

#3 @jeremyfelt
8 months ago

In wpmu_create_blog(), update_blog_status() is fired for at least the public meta key. This in turn updates the last_updated column for the site. That appears to be where the offset is happening.

One option could be to not store last_updated when wp_is_installing(). In this case, it would be 0000-00-00 00:00:00 rather than the same or a second off, but may be a more accurate indicator of whether the site has been updated after install.

Note: See TracTickets for help on using tickets.