From b2a2d1f0c6e71ce4743c0f89e85211697da3f1dc Mon Sep 17 00:00:00 2001 From: lfbn Date: Sat, 2 Jul 2016 11:14:48 +0100 Subject: [PATCH] When user is logged in no cache is made. --- index-wp-redis.php | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/index-wp-redis.php b/index-wp-redis.php index fbb8cca..69218ab 100644 --- a/index-wp-redis.php +++ b/index-wp-redis.php @@ -49,6 +49,7 @@ function getCleanUrl($secret) { $current_url = getCleanUrl($secret_string); // used to prefix ssl cached pages $isSSL = ((!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off') || $_SERVER['SERVER_PORT'] == 443) ? "ssl_" : ""; +$isLoggedIn = preg_match("/wordpress_logged_in/", var_export($_COOKIE, true)); $redis_key = $isSSL.md5($current_url); handleCDNRemoteAddressing(); @@ -104,7 +105,7 @@ function getCleanUrl($secret) { $unlimited = get_option('wp-redis-cache-debug',false); $seconds_cache_redis = get_option('wp-redis-cache-seconds',43200); // This page is cached, lets display it - } else if ($redis->exists($redis_key)) { + } else if ($redis->exists($redis_key) && !$isLoggedIn) { if ($debug) { echo "\n"; } @@ -120,8 +121,7 @@ function getCleanUrl($secret) { $isPOST = ($_SERVER['REQUEST_METHOD'] === 'POST') ? 1 : 0; - $loggedIn = preg_match("/wordpress_logged_in/", var_export($_COOKIE, true)); - if (!$isPOST && !$loggedIn) { + if (!$isPOST && !$isLoggedIn) { ob_start(); $level = ob_get_level(); require( $wp_blog_header_path ); @@ -167,10 +167,11 @@ function getCleanUrl($secret) { if (isset($seconds_cache_redis)) { echo "\n"; } + echo "\n"; echo "\n"; echo "\n"; if (isset($unlimited)) { echo "\n"; } echo "\n"; -} \ No newline at end of file +}