Changeset 49629
- Timestamp:
- 11/17/2020 03:42:57 PM (4 years ago)
- Location:
- trunk
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/functions.php
r49628 r49629 7625 7625 */ 7626 7626 function recurse_dirsize( $directory, $exclude = null, $max_execution_time = null, &$directory_cache = null ) { 7627 $size = 0;7628 7629 7627 $directory = untrailingslashit( $directory ); 7630 7628 $cache_path = untrailingslashit( str_replace( ABSPATH, '', $directory ) ); … … 7675 7673 * @since 5.6.0 7676 7674 * 7677 * @param int|false $space_used The amount of used space, in bytes. Default 0.7675 * @param int|false $space_used The amount of used space, in bytes. Default false. 7678 7676 */ 7679 $size = apply_filters( 'calculate_current_dirsize', $size, $directory, $exclude, $max_execution_time, $directory_cache ); 7680 7681 if ( 0 === $size ) { 7677 $size = apply_filters( 'pre_recurse_dirsize', false, $directory, $exclude, $max_execution_time, $directory_cache ); 7678 7679 if ( false === $size ) { 7680 $size = 0; 7681 7682 7682 $handle = opendir( $directory ); 7683 7683 if ( $handle ) { … … 7704 7704 } 7705 7705 } 7706 7706 7707 $directory_cache[ $cache_path ] = $size; 7707 7708 -
trunk/src/wp-includes/ms-functions.php
r49539 r49629 2630 2630 */ 2631 2631 $space_used = apply_filters( 'pre_get_space_used', false ); 2632 2632 2633 if ( false === $space_used ) { 2633 2634 $upload_dir = wp_upload_dir(); -
trunk/tests/phpunit/tests/multisite/cleanDirsizeCache.php
r49628 r49629 220 220 * @ticket 19879 221 221 */ 222 function test_ recurse_dirsize_calculate_current_dirsize_filter() {223 add_filter( ' calculate_current_dirsize', array( $this, '_filter_calculate_current_dirsize' ) );222 function test_pre_recurse_dirsize_filter() { 223 add_filter( 'pre_recurse_dirsize', array( $this, '_filter_pre_recurse_dirsize' ) ); 224 224 225 225 $upload_dir = wp_upload_dir(); 226 226 $this->assertSame( 1042, recurse_dirsize( $upload_dir['path'] ) ); 227 227 228 remove_filter( ' calculate_current_dirsize', array( $this, '_filter_calculate_current_dirsize' ) );229 } 230 231 function _filter_ calculate_current_dirsize() {228 remove_filter( 'pre_recurse_dirsize', array( $this, '_filter_pre_recurse_dirsize' ) ); 229 } 230 231 function _filter_pre_recurse_dirsize() { 232 232 return 1042; 233 233 }
Note: See TracChangeset
for help on using the changeset viewer.