Skip to content
Snippets Groups Projects
Commit b4df5339 authored by Erick Hitter's avatar Erick Hitter
Browse files

Better variable names

parent abbd5455
No related branches found
No related tags found
No related merge requests found
......@@ -311,12 +311,12 @@ try {
$load_wp = true;
// Relevant details on the current request
$is_post = ( ! empty( $GLOBALS['HTTP_RAW_POST_DATA'] ) || ! empty( $_POST ) );
$logged_in = (bool) preg_match( "#(wordpress_(logged|sec)|comment_author)#", var_export( $_COOKIE, true ) );
$is_post_request = ( ! empty( $GLOBALS['HTTP_RAW_POST_DATA'] ) || ! empty( $_POST ) );
$is_cache_exempt = (bool) preg_match( "#(wordpress_(logged|sec)|comment_author)#", var_export( $_COOKIE, true ) );
if ( $redis_page_cache_config['debug'] ) {
$redis_page_cache_config['debug_messages'] .= "<!-- POST request: " . ( $is_post ? 'yes' : 'no' ) . " -->\n";
$redis_page_cache_config['debug_messages'] .= "<!-- Logged in: " . ( $logged_in ? 'yes' : 'no' ) . " -->\n";
$redis_page_cache_config['debug_messages'] .= "<!-- POST request: " . ( $is_post_request ? 'yes' : 'no' ) . " -->\n";
$redis_page_cache_config['debug_messages'] .= "<!-- Cache exexmpt (logged in, commenter): " . ( $is_cache_exempt ? 'yes' : 'no' ) . " -->\n";
}
// Refresh request, deletes cache: either manual refresh cache by adding ?refresh=secret_string after the URL or somebody posting a comment
......@@ -327,7 +327,7 @@ try {
$redis->del( $redis_page_cache_config['redis_key'] );
// This page is cached, the user isn't logged in, and it isn't a POST request, so let's use the cache
} elseif ( ! $is_post && ! $logged_in && $redis->exists( $redis_page_cache_config['redis_key'] ) ) {
} elseif ( ! $is_post_request && ! $is_cache_exempt && $redis->exists( $redis_page_cache_config['redis_key'] ) ) {
if ( $redis_page_cache_config['debug'] ) {
$redis_page_cache_config['debug_messages'] .= "<!-- Serving page from cache -->\n";
}
......@@ -376,7 +376,7 @@ try {
}
// If user isn't logged in and this isn't a post request, render the requested page and cache if appropriate.
if ( ! $is_post && ! $logged_in ) {
if ( ! $is_post_request && ! $is_cache_exempt ) {
if ( $redis_page_cache_config['debug'] ) {
$redis_page_cache_config['debug_messages'] .= "<!-- Adding page to cache -->\n";
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment