wp_cache_phase2_clean_cache()
Hooks from the function
Return
null
. Nothing (null).
Usage
wp_cache_phase2_clean_cache( $file_prefix );
- $file_prefix (required)
- -
wp_cache_phase2_clean_cache() wp cache phase2 clean cache code WPSCache 1.12.4
function wp_cache_phase2_clean_cache( $file_prefix ) { global $wpdb, $blog_cache_dir; if ( ! wp_cache_writers_entry() ) { return false; } wp_cache_debug( "wp_cache_phase2_clean_cache: Cleaning cache in $blog_cache_dir" ); if ( $handle = @opendir( $blog_cache_dir ) ) { while ( false !== ( $file = @readdir( $handle ) ) ) { if ( str_contains( $file, $file_prefix ) ) { if ( strpos( $file, '.html' ) ) { // delete old wpcache files immediately wp_cache_debug( "wp_cache_phase2_clean_cache: Deleting obsolete wpcache cache+meta files: $file" ); @unlink( $blog_cache_dir . $file ); @unlink( $blog_cache_dir . 'meta/' . str_replace( '.html', '.meta', $file ) ); } else { $meta = json_decode( wp_cache_get_legacy_cache( $blog_cache_dir . 'meta/' . $file ), true ); if ( $meta['blog_id'] == $wpdb->blogid ) { @unlink( $blog_cache_dir . $file ); @unlink( $blog_cache_dir . 'meta/' . $file ); } } } } closedir( $handle ); do_action( 'wp_cache_cleared' ); } wp_cache_writers_exit(); }