wpseek.com
Un motore di ricerca WordPress per sviluppatori e autori di temi
clean_dirsize_cache › WordPress Function
Da5.6.0
Deprecaton/a
› clean_dirsize_cache ( $path )
Parametri: |
|
Definito a: |
|
Codex: | |
ChangeLog: |
|
Cleans directory size cache used by recurse_dirsize().
Removes the current directory and all parent directories from thedirsize_cache
transient.Funzioni correlate: clean_user_cache, clean_page_cache, clean_term_cache, clean_post_cache, wp_clean_update_cache
Sorgenti
function clean_dirsize_cache( $path ) { if ( ! is_string( $path ) || empty( $path ) ) { wp_trigger_error( '', sprintf( /* translators: 1: Function name, 2: A variable type, like "boolean" or "integer". */ __( '%1$s only accepts a non-empty path string, received %2$s.' ), '<code>clean_dirsize_cache()</code>', '<code>' . gettype( $path ) . '</code>' ) ); return; } $directory_cache = get_transient( 'dirsize_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( 'dirsize_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( 'dirsize_cache', $directory_cache, $expiration ); }