From 0022b3b1cc97ccf52acff2cee6d45cf3efe8f3b0 Mon Sep 17 00:00:00 2001 From: Francesco Date: Sat, 24 Nov 2018 15:38:38 +0100 Subject: [PATCH 1/2] Fix erratic $log_file_link and $raw_log_file_link On Windows backslashes in path break the replace. For example $log_file_link becomes: http://example.org/D:/my_sites/example_org/wp-content/cache/view_e1b50ae15624d52670a4a76c4ce03610.php Because ABSPATH value on Windows is: "D:\my_sites\example_org/" therefore it doesn't get replaced with the empty string. --- wp-cache.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/wp-cache.php b/wp-cache.php index 2fe4d71d..1c08d891 100644 --- a/wp-cache.php +++ b/wp-cache.php @@ -2085,8 +2085,8 @@ function wp_cache_debug_settings() { if ( ! isset( $wp_cache_debug_log ) || $wp_cache_debug_log == '' ) { extract( wpsc_create_debug_log() ); // $wp_cache_debug_log, $wp_cache_debug_username } - $log_file_link = "$wp_cache_debug_log"; - $raw_log_file_link = "" . __( 'RAW', 'wp-super-cache' ) . ""; + $log_file_link = "$wp_cache_debug_log"; + $raw_log_file_link = "" . __( 'RAW', 'wp-super-cache' ) . ""; if ( $wp_super_cache_debug == 1 ) { echo "

" . sprintf( __( 'Currently logging to: %s (%s)', 'wp-super-cache' ), $log_file_link, $raw_log_file_link ) . "

"; } else { From c42f6d4abba10e670f3183d9bc26f57d2d2321b7 Mon Sep 17 00:00:00 2001 From: Francesco Date: Mon, 26 Nov 2018 22:59:00 +0100 Subject: [PATCH 2/2] Fix $log_file_link and $raw_log_file_link on Win Second try :) --- wp-cache.php | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/wp-cache.php b/wp-cache.php index 1c08d891..f9265e69 100644 --- a/wp-cache.php +++ b/wp-cache.php @@ -2085,8 +2085,16 @@ function wp_cache_debug_settings() { if ( ! isset( $wp_cache_debug_log ) || $wp_cache_debug_log == '' ) { extract( wpsc_create_debug_log() ); // $wp_cache_debug_log, $wp_cache_debug_username } - $log_file_link = "$wp_cache_debug_log"; - $raw_log_file_link = "" . __( 'RAW', 'wp-super-cache' ) . ""; + if ( function_exists( 'wp_normalize_path' ) ) { + $cache_url = wp_normalize_path( $cache_path ); + $cache_url = str_replace( wp_normalize_path( ABSPATH ), '', $cache_url ); + } else { + $cache_url = str_replace( '\\', '/', $cache_path ); + $cache_url = str_replace( str_replace( '\\', '/', ABSPATH ), '', $cache_url ); + } + $cache_url = site_url( $cache_url ); + $log_file_link = "$wp_cache_debug_log"; + $raw_log_file_link = "" . __( 'RAW', 'wp-super-cache' ) . ""; if ( $wp_super_cache_debug == 1 ) { echo "

" . sprintf( __( 'Currently logging to: %s (%s)', 'wp-super-cache' ), $log_file_link, $raw_log_file_link ) . "

"; } else {