Make WordPress Core


Ignore:
Timestamp:
11/16/2020 10:29:42 PM (6 years ago)
Author:
helen
Message:

Multisite: More consistency for clean_dirsize_cache().

Props SergeyBiryukov.
Fixes #19879.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/functions.php

    r49580 r49616  
    27482748
    27492749        if ( is_multisite() ) {
    2750                 invalidate_dirsize_cache( $new_file );
     2750                clean_dirsize_cache( $new_file );
    27512751        }
    27522752
     
    76297629
    76307630        $directory  = untrailingslashit( $directory );
    7631         $cache_path = normalize_dirsize_cache_path( $directory );
     7631        $cache_path = untrailingslashit( str_replace( ABSPATH, '', $directory ) );
     7632
    76327633        $save_cache = false;
    76337634
     
    77237724 * @param string $path Full path of a directory or file.
    77247725 */
    7725 function invalidate_dirsize_cache( $path ) {
     7726function clean_dirsize_cache( $path ) {
    77267727        $directory_cache = get_transient( 'dirsize_cache' );
    77277728
     
    77307731        }
    77317732
    7732         $cache_path = normalize_dirsize_cache_path( $path );
     7733        $cache_path = untrailingslashit( str_replace( ABSPATH, '', $path ) );
    77337734        unset( $directory_cache[ $cache_path ] );
    77347735
     
    77397740
    77407741        set_transient( 'dirsize_cache', $directory_cache );
    7741 }
    7742 
    7743 /**
    7744  * Normalize dirsize cache path.
    7745  *
    7746  * Ensures array keys within the dirsize_cache transient follow the same format.
    7747  *
    7748  * @since 5.6.0
    7749  *
    7750  * @param string $path
    7751  * @return string
    7752  */
    7753 function normalize_dirsize_cache_path( $path ) {
    7754         $path = str_replace( ABSPATH, '', $path );
    7755 
    7756         return untrailingslashit( $path );
    77577742}
    77587743
Note: See TracChangeset for help on using the changeset viewer.