diff --git a/vivio-swift.zip b/vivio-swift.zip index 14f9287ae4dd8a5dbb36a16d72a85b2a22fc668a..0f3f6dac1796dbf5ec024cfb7aef6702ba59e2f2 100644 Binary files a/vivio-swift.zip and b/vivio-swift.zip differ diff --git a/vivio-swift/classes/vivio-swift-cache-excludes.php b/vivio-swift/classes/vivio-swift-cache-excludes.php index 47681f8082348ac924a11622faf57cc122372db0..74bca7261ef27ae1e5706db79579e7be0006d3a2 100644 --- a/vivio-swift/classes/vivio-swift-cache-excludes.php +++ b/vivio-swift/classes/vivio-swift-cache-excludes.php @@ -221,12 +221,6 @@ class Vivio_Swift_Cache_Excludes } else { $vivio_swift_global->debug_logger->log_debug("Vivio_Swift_Cache_Excludes::process_cache_excludes() - Forced refresh, skipping cookie checks.", 1); } - /* - if($_COOKIE["comment_author_"]||$_COOKIE["wordpress_logged_in"]||$_COOKIE["wp-postpass_"]||$_COOKIE["wp_woocommerce_session"]){ - $vivio_swift_global->debug_logger->log_debug("Vivio_Swift_Cache_Excludes::process_cache_excludes() - Exclude Cookie rule hit [SKIPPING]", 1); - return false; - } - */ if ($vivio_swift_global->configs->get_value('vivio_swift_cache_exclude_path_is')=='1') { diff --git a/vivio-swift/classes/vivio-swift-cache-onaccess.php b/vivio-swift/classes/vivio-swift-cache-onaccess.php index 2307a8e5e72551fc019a8e8399affe9aca546862..16ea834fbc0f242d2fe8796634dd606ce6b12822 100644 --- a/vivio-swift/classes/vivio-swift-cache-onaccess.php +++ b/vivio-swift/classes/vivio-swift-cache-onaccess.php @@ -51,21 +51,9 @@ class Vivio_Swift_Cache_OnAccess function create_page_cache() { global $vivio_swift_global; - $error = ''; - // TODO manually excluded cookies, URI's, useragents, pages $vivio_swift_global->debug_logger->log_debug("Vivio_Swift_Cache_OnAccess::create_page_cache() - creating page cache...",0); - - // process exclusions - if (!Vivio_Swift_Cache_Excludes::process_cache_excludes($url)){ - // if the url matches one of our excludes, don't cache it, just move on. - $error = 1; - } - - if ($error==''){ - $vivio_swift_global->debug_logger->log_debug("Vivio_Swift_Cache_OnAccess::create_page_cache() - loading page....",0); - ob_start(array($this, "create_page_cache_closer")); - } + ob_start(array($this, "create_page_cache_closer")); } function create_page_cache_closer($response) @@ -75,6 +63,12 @@ class Vivio_Swift_Cache_OnAccess $vivio_swift_global->debug_logger->log_debug("Vivio_Swift_Cache_OnAccess::create_page_cache_closer() - Initializing closer...",0); + // process exclusions + if (!Vivio_Swift_Cache_Excludes::process_cache_excludes($url)){ + // if the url matches one of our excludes, don't cache it, just move on. + return $response; + } + // don't cache certain responses if((function_exists("http_response_code")) && (http_response_code() != 200)) { diff --git a/vivio-swift/classes/vivio-swift-utility-htaccess.php b/vivio-swift/classes/vivio-swift-utility-htaccess.php index 4a35f02fc7fbfa485cdb3c334d69fda66e7daf55..229488e3095ccced3d3436a496e2e8160cee1e23 100644 --- a/vivio-swift/classes/vivio-swift-utility-htaccess.php +++ b/vivio-swift/classes/vivio-swift-utility-htaccess.php @@ -220,11 +220,11 @@ class Vivio_Swift_Utility_Htaccess $rules .= 'RewriteCond %{REQUEST_URI} \/$' . PHP_EOL; // ensure a cache file exists - $rules .= 'RewriteCond %{DOCUMENT_ROOT}'.$parsed_url['path'].VIVIO_SWIFT_CACHE_URL.'%{REQUEST_URI}/d/index.html -f [or]' . PHP_EOL; - $rules .= 'RewriteCond '.VIVIO_SWIFT_CACHE_PATH.'d/%{REQUEST_URI}/index.html -f' . PHP_EOL; + $rules .= 'RewriteCond %{DOCUMENT_ROOT}'.$parsed_url['path'].VIVIO_SWIFT_CACHE_URL.'$1/d/index.html -f [or]' . PHP_EOL; + $rules .= 'RewriteCond '.VIVIO_SWIFT_CACHE_PATH.'d/$1/index.html -f' . PHP_EOL; // send to cache file - $rules .= 'RewriteRule ^(.*) "'.$parsed_url['path'].VIVIO_SWIFT_CACHE_URL.'d/%{REQUEST_URI}/index.html" [L]' . PHP_EOL; + $rules .= 'RewriteRule ^(.*) "'.$parsed_url['path'].VIVIO_SWIFT_CACHE_URL.'d/$1/index.html" [L]' . PHP_EOL; // when we need more rules // $rules .= '' . PHP_EOL;