wp_cache_clean_legacy_files()
Хуков нет.
Возвращает
null. Ничего (null).
Использование
wp_cache_clean_legacy_files( $dir, $file_prefix );
- $dir(обязательный)
- .
- $file_prefix(обязательный)
- .
Код wp_cache_clean_legacy_files() wp cache clean legacy files WPSCache 3.1.0
function wp_cache_clean_legacy_files( $dir, $file_prefix ) {
global $wpdb;
$dir = trailingslashit( $dir );
if ( @is_dir( $dir . 'meta' ) == false )
return false;
if ( $handle = @opendir( $dir ) ) {
$curr_blog_id = is_multisite() ? get_current_blog_id() : false;
while ( false !== ( $file = readdir( $handle ) ) ) {
if ( is_file( $dir . $file ) == false || $file == 'index.html' ) {
continue;
}
if ( str_contains( $file, $file_prefix ) ) {
if ( strpos( $file, '.html' ) ) {
// delete old WPCache files immediately
@unlink( $dir . $file);
@unlink( $dir . 'meta/' . str_replace( '.html', '.meta', $file ) );
} else {
$meta = json_decode( wp_cache_get_legacy_cache( $dir . 'meta/' . $file ), true );
if ( $curr_blog_id && $curr_blog_id !== (int) $meta['blog_id'] ) {
continue;
}
@unlink( $dir . $file);
@unlink( $dir . 'meta/' . $file);
}
}
}
closedir($handle);
}
}