[wp-trac] [WordPress Trac] #28238: Add filter to value returned from get_space_used()

WordPress Trac noreply at wordpress.org
Fri Aug 22 04:07:18 UTC 2014


#28238: Add filter to value returned from get_space_used()
---------------------------+------------------------------
 Reporter:  hereswhatidid  |       Owner:
     Type:  enhancement    |      Status:  new
 Priority:  normal         |   Milestone:  Awaiting Review
Component:  Upload         |     Version:  3.5
 Severity:  normal         |  Resolution:
 Keywords:  has-patch      |     Focuses:  multisite
---------------------------+------------------------------

Comment (by hereswhatidid):

 This was specifically for a couple plugins that were uploading media
 outside of the expected locations.  So in order to calculate the current
 space used I would have to take the value from get_space_used and add the
 space used by the other files to this.  The problem with the current
 pre_get_space_used is that in order to simply add additional space
 calculations to the value it's necessary to completely recreate how core
 is currently calculating the space used.  If we had a filter that ran
 after the core space calculations are run it would be easier and more
 stable to just add the additional values to that.  This would also be
 safer from a compatibility perspective in the off chance that the core
 method for calculating space used:


 {{{
         if ( false === $space_used ) {
                 $upload_dir = wp_upload_dir();
                 $space_used = get_dirsize( $upload_dir['basedir'] ) / 1024
 / 1024;
         }
 }}}

 were to change at some point.

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


More information about the wp-trac mailing list