Make WordPress Core

Opened 7 years ago

Closed 5 years ago

#41064 closed defect (bug) (duplicate)

Registered and last edited dates on new sites should be identical

Reported by: desrosj's profile desrosj Owned by: desrosj's profile desrosj
Milestone: 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 (5)

#1 @nnikolov
7 years 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.

7 years ago

#3 @jeremyfelt
7 years 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.

#4 @desrosj
6 years ago

  • Owner set to desrosj
  • Status changed from new to assigned

#5 @pento
5 years ago

  • Milestone Awaiting Review deleted
  • Resolution set to duplicate
  • Status changed from assigned to closed

This was fixed by the creation of wp_insert_site() in #40364.

Note: See TracTickets for help on using tickets.