[wp-trac] [WordPress Trac] #40247: Fix the `site-details` cache not being set sometimes

WordPress Trac noreply at wordpress.org
Thu Mar 23 23:49:01 UTC 2017


#40247: Fix the `site-details` cache not being set sometimes
--------------------------------+-----------------------------
 Reporter:  flixos90            |      Owner:
     Type:  defect (bug)        |     Status:  new
 Priority:  normal              |  Milestone:  Awaiting Review
Component:  Networks and Sites  |    Version:  4.6
 Severity:  normal              |   Keywords:  needs-patch
  Focuses:  multisite           |
--------------------------------+-----------------------------
 When introducing the lazy-loading functionality for sites in
 [changeset:37918], we made a mistake as far as I can see: In
 `WP_Site::get_details()` we check for falsy site detail values, and if one
 of them is false, the data is not cached. This is a problem, since
 sometimes that data can actually be not set (mainly `post_count`).

 When reading through the original ticket #36935, the reason we implemented
 this check was so that the function wouldn't cache an invalid dataset when
 requesting site details too early (for example in `sunrise.php`). However,
 a little further in that discussion we decided that we'd introduce the
 `ms_loaded` hook and use that for detection instead. That's what we ended
 up doing, but never removed the original checks, which should under those
 new circumstances be unnecessary, and actually cause this problem.

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


More information about the wp-trac mailing list