Commit bf56db5a authored by Jordan Michaels's avatar Jordan Michaels

update htaccess method

parent 0451845f
No preview for this file type
......@@ -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')
{
......
......@@ -51,22 +51,10 @@ 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"));
}
}
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))
{
......
......@@ -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;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment