Make WordPress Core

Ticket #54221: dirsize_expiration_2023-09-05.patch

File dirsize_expiration_2023-09-05.patch, 1.2 KB (added by nicomollet, 22 months ago)

Adding expiration to dirsize_cache transient so that it can be updated with autoload=no (fix no wp_install, expiration after early return)

  • wp-includes/functions.php

    IDEA additional info:
    Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
    <+>UTF-8
    diff --git a/wp-includes/functions.php b/wp-includes/functions.php
    a b  
    84788478
    84798479        // Only write the transient on the top level call and not on recursive calls.
    84808480        if ( $save_cache ) {
    8481                 set_transient( 'dirsize_cache', $directory_cache );
     8481                $expiration = ( wp_using_ext_object_cache() ) ? 0 : 10 * YEAR_IN_SECONDS;
     8482                set_transient( 'dirsize_cache', $directory_cache, $expiration );
    84828483        }
    84838484
    84848485        return $size;
     
    85138514                return;
    85148515        }
    85158516
     8517        $expiration = ( wp_using_ext_object_cache() ) ? 0 : 10 * YEAR_IN_SECONDS;
    85168518        if (
    85178519                ! str_contains( $path, '/' ) &&
    85188520                ! str_contains( $path, '\\' )
    85198521        ) {
    85208522                unset( $directory_cache[ $path ] );
    8521                 set_transient( 'dirsize_cache', $directory_cache );
     8523                set_transient( 'dirsize_cache', $directory_cache, $expiration );
    85228524                return;
    85238525        }
    85248526
     
    85378539                unset( $directory_cache[ $path ] );
    85388540        }
    85398541
    8540         set_transient( 'dirsize_cache', $directory_cache );
     8542        set_transient( 'dirsize_cache', $directory_cache, $expiration );
    85418543}
    85428544
    85438545/**