[wp-trac] [WordPress Trac] #47083: Site Info Update Not Adjusting "Last Updated" Value

WordPress Trac noreply at wordpress.org
Thu May 9 15:49:14 UTC 2019


#47083: Site Info Update Not Adjusting "Last Updated" Value
--------------------------------+------------------------------
 Reporter:  conner_bw           |       Owner:  (none)
     Type:  defect (bug)        |      Status:  new
 Priority:  normal              |   Milestone:  Awaiting Review
Component:  Networks and Sites  |     Version:  5.1.1
 Severity:  normal              |  Resolution:
 Keywords:                      |     Focuses:  multisite
--------------------------------+------------------------------

Comment (by tmdesigned):

 I was able to replicate this behavior. The individual site setting change
 did not update the "last updated" value, while the bulk action did.

 The lines of code you called out:
 {{{
 $details = array_merge($current_details, $details);
 $details['last_updated'] = current_time('mysql', true);
 }}}
 actually do still exist. Much of that code was just abstracted into the
 new {{{ wp_update_site}}} function (currently ms-site.php, starting line
 150). However, while the current datetime is being calculated, it is
 processed through {{{wp_prepare_site_data}}}, where it is treated as a
 "default" value against which the form data value is compared.

 When editing a single site, the **form value** of {{{last_updated}}} is
 submitted along with the other values--it is one of the form fields on
 that page, after all--so that value for the datetime wins out over the
 "default".

 When bulk editing sites, only the selected bulk attribute is provided
 (i.e. {{{spam}}}), so the new datetime, which again is treated as a
 default, is updated.

 It looks like previous to 5.1, the datetime was being calculated and added
 to the payload after the form values were pulled, so the calculated time
 won out over whatever you entered there.

 I do not know if this behavior change is intended. My own opinion of the
 best behavior would be to compare the form value of the datetime with the
 existing stored value. If they are the same (meaning the user did not edit
 the field), then it should be updated with the calculated time. If they
 are different, it should use whatever they typed in.

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


More information about the wp-trac mailing list