diff --git a/wp-admin/includes/upgrade.php b/wp-admin/includes/upgrade.php index 9014d97100..72f3536578 100644 --- a/wp-admin/includes/upgrade.php +++ b/wp-admin/includes/upgrade.php @@ -874,7 +874,7 @@ function upgrade_all() { upgrade_550(); } - if ( $wp_current_db_version < 49632 ) { + if ( $wp_current_db_version < 49735 ) { upgrade_560(); } @@ -2274,6 +2274,10 @@ function upgrade_560() { */ save_mod_rewrite_rules(); } + + if ( $wp_current_db_version < 49735 ) { + delete_transient( 'dirsize_cache' ); + } } /** diff --git a/wp-includes/functions.php b/wp-includes/functions.php index 3b0dfda4bf..7219d768a9 100644 --- a/wp-includes/functions.php +++ b/wp-includes/functions.php @@ -7626,8 +7626,6 @@ function get_dirsize( $directory, $max_execution_time = null ) { */ function recurse_dirsize( $directory, $exclude = null, $max_execution_time = null, &$directory_cache = null ) { $directory = untrailingslashit( $directory ); - $cache_path = untrailingslashit( str_replace( ABSPATH, '', $directory ) ); - $save_cache = false; if ( ! isset( $directory_cache ) ) { @@ -7635,8 +7633,8 @@ function recurse_dirsize( $directory, $exclude = null, $max_execution_time = nul $save_cache = true; } - if ( isset( $directory_cache[ $cache_path ] ) ) { - return $directory_cache[ $cache_path ]; + if ( isset( $directory_cache[ $directory ] ) && is_int( $directory_cache[ $directory ] ) ) { + return $directory_cache[ $directory ]; } if ( ! file_exists( $directory ) || ! is_dir( $directory ) || ! is_readable( $directory ) ) { @@ -7705,7 +7703,7 @@ function recurse_dirsize( $directory, $exclude = null, $max_execution_time = nul } } - $directory_cache[ $cache_path ] = $size; + $directory_cache[ $directory ] = $size; // Only write the transient on the top level call and not on recursive calls. if ( $save_cache ) { @@ -7731,12 +7729,12 @@ function clean_dirsize_cache( $path ) { return; } - $cache_path = untrailingslashit( str_replace( ABSPATH, '', $path ) ); - unset( $directory_cache[ $cache_path ] ); + $path = untrailingslashit( $path ); + unset( $directory_cache[ $path ] ); - while ( DIRECTORY_SEPARATOR !== $cache_path && '.' !== $cache_path && '..' !== $cache_path ) { - $cache_path = dirname( $cache_path ); - unset( $directory_cache[ $cache_path ] ); + while ( DIRECTORY_SEPARATOR !== $path && '.' !== $path && '..' !== $path ) { + $path = dirname( $path ); + unset( $directory_cache[ $path ] ); } set_transient( 'dirsize_cache', $directory_cache ); diff --git a/wp-includes/version.php b/wp-includes/version.php index 902303bbdf..7ec9f69aed 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -13,14 +13,14 @@ * * @global string $wp_version */ -$wp_version = '5.7-alpha-49741'; +$wp_version = '5.7-alpha-49744'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema. * * @global int $wp_db_version */ -$wp_db_version = 49632; +$wp_db_version = 49735; /** * Holds the TinyMCE version.