1024 ) { $fsize = number_format( $fsize / 1024, 2 ) . "MB"; } elseif ( $fsize != 0 ) { $fsize = number_format( $fsize, 2 ) . "KB"; } else { $fsize = "0KB"; } return $fsize; } function wp_cache_regenerate_cache_file_stats() { global $cache_compression, $supercachedir, $file_prefix, $wp_cache_preload_on, $cache_max_time; if ( $supercachedir == '' ) $supercachedir = get_supercache_dir(); $sizes = wpsc_generate_sizes_array(); $now = time(); if (is_dir( $supercachedir ) ) { if ( $dh = opendir( $supercachedir ) ) { while ( ( $entry = readdir( $dh ) ) !== false ) { if ( $entry != '.' && $entry != '..' ) { $sizes = wpsc_dirsize( trailingslashit( $supercachedir ) . $entry, $sizes ); } } closedir( $dh ); } } foreach( $sizes as $cache_type => $list ) { foreach( array( 'cached_list', 'expired_list' ) as $status ) { $cached_list = array(); foreach( $list[ $status ] as $dir => $details ) { if ( $details[ 'files' ] == 2 && !isset( $details[ 'upper_age' ] ) ) { $details[ 'files' ] = 1; } $cached_list[ $dir ] = $details; } $sizes[ $cache_type ][ $status ] = $cached_list; } } if ( $cache_compression ) { $sizes[ 'supercache' ][ 'cached' ] = intval( $sizes[ 'supercache' ][ 'cached' ] / 2 ); $sizes[ 'supercache' ][ 'expired' ] = intval( $sizes[ 'supercache' ][ 'expired' ] / 2 ); } $cache_stats = array( 'generated' => time(), 'supercache' => $sizes[ 'supercache' ], 'wpcache' => $sizes[ 'wpcache' ] ); update_option( 'supercache_stats', $cache_stats ); return $cache_stats; } function wp_cache_files() { global $cache_path, $file_prefix, $cache_max_time, $valid_nonce, $supercachedir, $super_cache_enabled, $blog_cache_dir, $cache_compression; global $wp_cache_preload_on; if ( '/' != substr($cache_path, -1)) { $cache_path .= '/'; } if ( $valid_nonce ) { if(isset($_REQUEST['wp_delete_cache'])) { wp_cache_clean_cache($file_prefix); $_GET[ 'action' ] = 'regenerate_cache_stats'; } if ( isset( $_REQUEST[ 'wp_delete_all_cache' ] ) ) { wp_cache_clean_cache( $file_prefix, true ); $_GET[ 'action' ] = 'regenerate_cache_stats'; } if(isset($_REQUEST['wp_delete_expired'])) { wp_cache_clean_expired($file_prefix); $_GET[ 'action' ] = 'regenerate_cache_stats'; } } echo ""; echo '
" . __( 'Cache stats are not automatically generated. You must click the link below to regenerate the stats on this page.', 'wp-super-cache' ) . "
" . sprintf( __( 'Cache stats last generated: %s minutes ago.', 'wp-super-cache' ), number_format( ( time() - $cache_stats[ 'generated' ] ) / 60 ) ) . "
" . __( 'WP-Cache', 'wp-super-cache' ) . " ({$fsize})
" . __( 'WP-Super-Cache', 'wp-super-cache' ) . " ({$fsize})
" . __( 'Hide file list', 'wp-super-cache' ) . "
" . __( 'Too many cached files, no listing possible.', 'wp-super-cache' ) . "
'wpsupercache', 'listfiles' => '1' ) ), 'wp-cache' ) . "#listfiles'>" . __( 'List all cached files', 'wp-super-cache' ) . "
" . sprintf( __( 'Expired files are files older than %s seconds. They are still used by the plugin and are deleted periodically.', 'wp-super-cache' ), $cache_max_time ) . "
" . __( 'Preload mode is enabled. Supercache files will never be expired.', 'wp-super-cache' ) . "