[wp-trac] [WordPress Trac] #19879: Better caching for get_dirsize

WordPress Trac noreply at wordpress.org
Wed Oct 14 14:59:24 UTC 2020


#19879: Better caching for get_dirsize
-------------------------------------------------+-------------------------
 Reporter:  batmoo                               |       Owner:  (none)
     Type:  enhancement                          |      Status:  new
 Priority:  normal                               |   Milestone:  5.6
Component:  Filesystem API                       |     Version:  3.3.1
 Severity:  normal                               |  Resolution:
 Keywords:  has-patch dev-feedback needs-dev-    |     Focuses:  multisite,
  note has-unit-tests                            |  performance
-------------------------------------------------+-------------------------

Comment (by janthiel):

 This code should be backward compatible without breaking anything.

 Still there are some plugins which **might** be affected by this. Because
 up until now the only way to implement any way of custom space calculation
 was using the {{{pre_get_space_used}}} filter.
 This forced one to re-implement the dirsize caching oneself which will not
 be compatible with the new code. If there is a custom implementation
 around the {{{pre_get_space_used}}} filter working with the
 {{{dirsize_cache}}} transient, this patch won't break anything but the new
 optimized caching would not kick in. So the worst case is that there is no
 performance gain. This should be well documented and communicated so that
 plugin authors can adapt.

 If a plugin does anything around {{{get_dirsize}}}, {{{recurse_dirsize}}}
 the {{{pre_get_space_used}}} filter or the {{{dirsize_cache}}} transient,
 it might be affected and requires changes to fully leverage this
 optimizations. Those plugin authors should consider moving to the new
 {{{calculate_current_dirsize}}} filter instead.

 I reached out to some of the Media Offloading Plugin vendors and asked for
 some feedback based on their codebase.

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


More information about the wp-trac mailing list