[wp-trac] [WordPress Trac] #30202: In multisite, the "storage space used" is incorrectly calculated for the main blog/site.

WordPress Trac noreply at wordpress.org
Sun Jul 12 22:01:57 UTC 2015


#30202: In multisite, the "storage space used" is incorrectly calculated for the
main blog/site.
--------------------------------+-------------------------
 Reporter:  rebekahickey        |       Owner:  jeremyfelt
     Type:  defect (bug)        |      Status:  assigned
 Priority:  normal              |   Milestone:  4.3
Component:  Networks and Sites  |     Version:  4.0
 Severity:  normal              |  Resolution:
 Keywords:  has-patch           |     Focuses:  multisite
--------------------------------+-------------------------
Changes (by jeremyfelt):

 * keywords:  has-patch needs-refresh => has-patch


Comment:

 Replying to [comment:8 earnjam]:
 > Just thought about a scenario here...since we cache the return from
 `get_dirsize()` as a transient, it's possible that if it was called
 directly outside of core with the new exclude parameter passed to it, it
 would cache that value instead of the expected core usage.
 >
 > Not sure the best way to prevent that.
 >
 > Perhaps don't cache the value if the exclude parameter is passed to it
 unless it is for the main site uploads directory?

 I went with this as well in the latest patch, but I'm thinking we may just
 want to leave it alone. `get_dirsize()` has always returned the cached
 value when requested, so it's a very specific function and use for
 anything else would lead to strange results in general. If we want to make
 this more accessible to developers, there's probably a better way to do
 it.

 Replying to [comment:12 wonderboymusic]:
 > 30202.2.diff​ is a refresh but 4 unit tests fail. This sucks because it
 is hard to toggle the value for blog_upload_space and then reset it to the
 proper value between tests while taking into account attachments from src
 install.

 I've gotten around this in
 [https://core.trac.wordpress.org/attachment/ticket/30202/30202.3.diff
 30202.3.diff].

 * Moved the tests to their own file to match the pattern we've been using
 elsewhere recently.
 * New sites are created until it is detected that we have an empty uploads
 directory for that site.
 * We then know it's safe to remove the folder and its contents entirely
 when the test is complete.
 * The main site can be handled directly in the individual test by checking
 space used before any new site is created.

 I'm going to think through this a bit more and make some of the transient
 changes. Should be close.

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


More information about the wp-trac mailing list