From 641fd5a16f8b39a6cc511b8ac8da564e3bca1d06 Mon Sep 17 00:00:00 2001 From: Shish Date: Sun, 9 Feb 2020 16:25:17 +0000 Subject: [PATCH] remove CACHE_HTTP - client side page cache causes more problems than it solves --- core/basepage.php | 16 ---------------- core/sys_config.php | 1 - ext/user/main.php | 2 +- tests/defines.php | 1 - 4 files changed, 1 insertion(+), 19 deletions(-) diff --git a/core/basepage.php b/core/basepage.php index 05334b08..5be25888 100644 --- a/core/basepage.php +++ b/core/basepage.php @@ -287,22 +287,6 @@ class BasePage switch ($this->mode) { case PageMode::PAGE: - if (CACHE_HTTP) { - global $user; - header("Vary: Cookie, Accept-Encoding"); - if ($user->is_anonymous() && $_SERVER["REQUEST_METHOD"] == "GET") { - header("Cache-control: public, max-age=600"); - header('Expires: ' . gmdate('D, d M Y H:i:s', time() + 600) . ' GMT'); - } else { - #header("Cache-control: private, max-age=0"); - header("Cache-control: no-cache"); - header('Expires: ' . gmdate('D, d M Y H:i:s', time() - 600) . ' GMT'); - } - } - #else { - # header("Cache-control: no-cache"); - # header('Expires: ' . gmdate('D, d M Y H:i:s', time() - 600) . ' GMT'); - #} usort($this->blocks, "blockcmp"); $this->add_auto_html_headers(); $this->render(); diff --git a/core/sys_config.php b/core/sys_config.php index ebf0a1ed..29b0827f 100644 --- a/core/sys_config.php +++ b/core/sys_config.php @@ -22,7 +22,6 @@ _d("DATABASE_DSN", null); // string PDO database connection details _d("DATABASE_TIMEOUT", 10000);// int Time to wait for each statement to complete _d("CACHE_DSN", null); // string cache connection details _d("DEBUG", false); // boolean print various debugging details -_d("CACHE_HTTP", false); // boolean output explicit HTTP caching headers _d("COOKIE_PREFIX", 'shm'); // string if you run multiple galleries with non-shared logins, give them different prefixes _d("SPEED_HAX", false); // boolean do some questionable things in the name of performance _d("NICE_URLS", false); // boolean force niceurl mode diff --git a/ext/user/main.php b/ext/user/main.php index 64c23694..7dd67093 100644 --- a/ext/user/main.php +++ b/ext/user/main.php @@ -405,7 +405,7 @@ class UserPage extends Extension { global $page, $config; $page->add_cookie("session", "", time() + 60 * 60 * 24 * $config->get_int('login_memory'), "/"); - if (CACHE_HTTP || SPEED_HAX) { + if (SPEED_HAX) { # to keep as few versions of content as possible, # make cookies all-or-nothing $page->add_cookie("user", "", time() + 60 * 60 * 24 * $config->get_int('login_memory'), "/"); diff --git a/tests/defines.php b/tests/defines.php index 93d74f0d..58a3d682 100644 --- a/tests/defines.php +++ b/tests/defines.php @@ -6,7 +6,6 @@ define("DATABASE_DSN", null); define("DATABASE_TIMEOUT", 10000); define("CACHE_DSN", null); define("DEBUG", false); -define("CACHE_HTTP", false); define("COOKIE_PREFIX", 'shm'); define("SPEED_HAX", false); define("NICE_URLS", true);