wpsc_delete_files()
Хуков нет.
Возвращает
null
. Ничего (null).
Использование
wpsc_delete_files( $dir, $delete );
- $dir (обязательный)
- -
- $delete **
- -
По умолчанию: true
Код wpsc_delete_files() wpsc delete files WPSCache 1.12.4
function wpsc_delete_files( $dir, $delete = true ) { global $cache_path; static $protected = ''; if ( $dir == '' ) { wp_cache_debug( 'wpsc_delete_files: directory is blank' ); return false; } wp_cache_debug( 'wpsc_delete_files: deleting ' . $dir ); // only do this once, this function will be called many times if ( $protected == '' ) { $protected = array( $cache_path, $cache_path . 'blogs/', $cache_path . 'supercache' ); foreach ( $protected as $id => $directory ) { $protected[ $id ] = trailingslashit( wpsc_get_realpath( $directory ) ); } } $orig_dir = $dir; $dir = wpsc_get_realpath( $dir ); if ( ! $dir ) { wp_cache_debug( 'wpsc_delete_files: directory does not exist: ' . $orig_dir ); return false; } $dir = trailingslashit( $dir ); if ( ! wpsc_is_in_cache_directory( $dir ) ) { wp_cache_debug( 'wpsc_delete_files: directory is not in cache directory: ' . $dir ); return false; } if ( in_array( $dir, $protected ) ) { wp_cache_debug( 'wpsc_delete_files: directory is protected ' . $dir ); return false; } if ( is_dir( $dir ) && $dh = @opendir( $dir ) ) { while ( ( $file = readdir( $dh ) ) !== false ) { wp_cache_debug( 'wpsc_delete_files: reading files: ' . $file ); if ( $file != '.' && $file != '..' && $file != '.htaccess' && is_file( $dir . $file ) ) { if ( $delete ) { wp_cache_debug( 'wpsc_delete_files: deleting ' . $dir . $file ); @unlink( $dir . $file ); } else { wp_cache_debug( 'wpsc_delete_files: rebuild or delete ' . $dir . $file ); @wp_cache_rebuild_or_delete( $dir . $file ); } } } closedir( $dh ); if ( $delete ) { wp_cache_debug( 'wpsc_delete_files: remove directory ' . $dir ); @rmdir( $dir ); } } else { wp_cache_debug( 'wpsc_delete_files: could not open directory ' . $dir ); } return true; }