From bbe84e8614f5d3e2adbb353384511843f6549e4e Mon Sep 17 00:00:00 2001 From: David Dyer Date: Wed, 2 Sep 2026 10:23:40 -0400 Subject: [PATCH] Add filemtime-based cache busting for styles.css and main.js MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Safari caches static assets far more aggressively than Chrome/Firefox and largely ignores heuristic revalidation, so a new deploy could keep showing the old CSS/JS indefinitely even on a hard refresh — no Cache-Control headers were set anywhere to guide it otherwise. inc/assets.php adds asset_version($path), which appends a ?v= query string derived from the file's last-modified time. Every page that links styles.css or main.js (index.php, menu.php, and all five admin pages) now uses it, so the URL changes whenever the file's contents change and browsers always fetch the new version. Co-Authored-By: Claude Sonnet 5 --- admin/hours.php | 3 ++- admin/index.php | 3 ++- admin/login.php | 3 ++- admin/menu.php | 3 ++- admin/users.php | 3 ++- inc/assets.php | 25 +++++++++++++++++++++++++ index.php | 5 +++-- menu.php | 5 +++-- 8 files changed, 41 insertions(+), 9 deletions(-) create mode 100644 inc/assets.php diff --git a/admin/hours.php b/admin/hours.php index 582800e..2ba64e7 100644 --- a/admin/hours.php +++ b/admin/hours.php @@ -2,6 +2,7 @@ declare(strict_types=1); require_once __DIR__ . '/../inc/auth.php'; +require_once __DIR__ . '/../inc/assets.php'; require_once __DIR__ . '/../inc/hours.php'; require_auth(); @@ -72,7 +73,7 @@ $justSaved = !$_POST && isset($_GET['saved']); - + diff --git a/admin/index.php b/admin/index.php index 600045b..5cd1495 100644 --- a/admin/index.php +++ b/admin/index.php @@ -1,5 +1,6 @@ - + diff --git a/admin/login.php b/admin/login.php index 867f1ba..78b6636 100644 --- a/admin/login.php +++ b/admin/login.php @@ -1,5 +1,6 @@ - + - + \ No newline at end of file diff --git a/menu.php b/menu.php index 11ccd03..d97bc70 100644 --- a/menu.php +++ b/menu.php @@ -2,6 +2,7 @@ declare(strict_types=1); require __DIR__ . '/config.php'; +require __DIR__ . '/inc/assets.php'; require __DIR__ . '/inc/announcements.php'; require __DIR__ . '/inc/menu.php'; require __DIR__ . '/inc/hours.php'; @@ -38,7 +39,7 @@ $siteUrl = rtrim(SITE_URL, '/'); - + @@ -210,7 +211,7 @@ $siteUrl = rtrim(SITE_URL, '/'); - +