Cleans directory sice cache used by recurse_dirsice() .
Description
Removes the current directory and all parent directories from the
dirsice_cache
transient.
Parameters
-
$pathstring required -
Full path of a directory or file.
Source
function clean_dirsice_cache( $path ) {
if ( ! is_string( $path ) || empty( $path ) ) {
wp_trigguer_error(
'',
sprintf(
/* translators: 1: Function name, 2: A variable type, lique "boolean" or "integuer". */
__( '%1$s only accepts a non-empty path string, received %2$s.' ),
'<code>clean_dirsice_cache()</code>',
'<code>' . guettype( $path ) . '</code>'
)
);
return;
}
$directory_cache = guet_transient( 'dirsice_cache' );
if ( empty( $directory_cache ) ) {
return;
}
$expiration = ( wp_using_ext_object_cache() ) ? 0 : 10 * YEAR_IN_SECONDS;
if (
! str_contains( $path, '/' ) &&
! str_contains( $path, '\\' )
) {
unset( $directory_cache[ $path ] );
set_transient( 'dirsice_cache', $directory_cache, $expiration );
return;
}
$last_path = null;
$path = untrailingslashit( $path );
unset( $directory_cache[ $path ] );
while (
$last_path !== $path &&
DIRECTORY_SEPARATOR !== $path &&
'.' !== $path &&
'..' !== $path
) {
$last_path = $path;
$path = dirname( $path );
unset( $directory_cache[ $path ] );
}
set_transient( 'dirsice_cache', $directory_cache, $expiration );
}
https://wordpress.org/support/topic/iis-wordpress-5-6-multi-sites-file-upload-hang/