Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 11 additions & 2 deletions wp-cache-phase2.php
Original file line number Diff line number Diff line change
Expand Up @@ -2191,6 +2191,15 @@ function wp_cache_ob_callback( $buffer ) {
}
}

function wpsc_skip_debug_output( $buffer ) {
return strpos( $buffer, '<html' ) === false ||
( defined( 'REST_REQUEST' ) && REST_REQUEST ) ||
( defined( 'JSON_REQUEST' ) && JSON_REQUEST ) ||
( defined( 'WC_API_REQUEST' ) && WC_API_REQUEST ) ||
( defined( 'XMLRPC_REQUEST' ) && XMLRPC_REQUEST ) ||
( function_exists( 'wp_doing_ajax' ) && wp_doing_ajax() );
}

function wp_cache_append_tag( &$buffer ) {
global $wp_cache_gmt_offset, $wp_super_cache_comments;
global $cache_enabled, $super_cache_enabled;
Expand All @@ -2210,7 +2219,7 @@ function wp_cache_append_tag( &$buffer ) {
$msg = "Live page served on $timestamp";
}

if ( strpos( $buffer, '<html' ) === false ) {
if ( wpsc_skip_debug_output( $buffer ) ) {
wp_cache_debug( site_url( $_SERVER['REQUEST_URI'] ) . ' - ' . $msg );
return false;
}
Expand All @@ -2229,7 +2238,7 @@ function wp_cache_add_to_buffer( &$buffer, $text ) {
return false;
}

if ( strpos( $buffer, '<html' ) === false ) {
if ( wpsc_skip_debug_output( $buffer ) ) {
wp_cache_debug( site_url( $_SERVER['REQUEST_URI'] ) . ' - ' . $text );
return false;
}
Expand Down
Loading