wp_cache_rebuild_or_delete()
No Hooks.
Return
null
. Nothing (null).
Usage
wp_cache_rebuild_or_delete( $file );
- $file (required)
- -
wp_cache_rebuild_or_delete() wp cache rebuild or delete code WPSCache 1.12.4
function wp_cache_rebuild_or_delete( $file ) { global $cache_rebuild_files, $cache_path, $file_prefix; if ( strpos( $file, '?' ) !== false ) { $file = substr( $file, 0, strpos( $file, '?' ) ); } $file = wpsc_get_realpath( $file ); if ( ! $file ) { wp_cache_debug( "wp_cache_rebuild_or_delete: file doesn't exist" ); return false; } if ( ! wpsc_is_in_cache_directory( $file ) ) { wp_cache_debug( "rebuild_or_gc quitting because file is not in cache_path: $file" ); return false; } $protected = wpsc_get_protected_directories(); foreach ( $protected as $id => $directory ) { $protected[ $id ] = wpsc_get_realpath( $directory ); } if ( in_array( $file, $protected ) ) { wp_cache_debug( "rebuild_or_gc: file is protected: $file" ); return false; } if ( substr( basename( $file ), 0, mb_strlen( $file_prefix ) ) == $file_prefix ) { @unlink( $file ); wp_cache_debug( "rebuild_or_gc: deleted non-anonymous file: $file" ); return false; } if ( substr( basename( $file ), 0, 5 + mb_strlen( $file_prefix ) ) == 'meta-' . $file_prefix ) { @unlink( $file ); wp_cache_debug( "rebuild_or_gc: deleted meta file: $file" ); return false; } if ( false == @file_exists( $file ) ) { wp_cache_debug( "rebuild_or_gc: file has disappeared: $file" ); return false; } if ( $cache_rebuild_files && substr( $file, -14 ) != '.needs-rebuild' ) { if ( @rename( $file, $file . '.needs-rebuild' ) ) { @touch( $file . '.needs-rebuild' ); wp_cache_debug( "rebuild_or_gc: rename file to {$file}.needs-rebuild", 2 ); } else { @unlink( $file ); wp_cache_debug( "rebuild_or_gc: rename failed. deleted $file", 2 ); } } else { $mtime = @filemtime( $file ); if ( $mtime && ( time() - $mtime ) > 10 ) { @unlink( $file ); wp_cache_debug( "rebuild_or_gc: rebuild file found. deleted because it was too old: $file", 2 ); } } }