From 10e131014d49ee930bc8a4cfef75ddcd7b1373b0 Mon Sep 17 00:00:00 2001 From: Developer Date: Fri, 20 Mar 2026 01:50:08 -0400 Subject: [PATCH] CRITICAL FIX: Auto-clear stale cache on git pull MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit AUTO-CLEAR MECHANISM: - Checks if launcher.sh is newer than .sysref.beta - After git pull, launcher.sh is always updated - If cache is older than launcher, auto-clears it - Fresh cache is rebuilt on next run SOLVES: ✅ Stale cache after git pull (now auto-cleared) ✅ Old WordPress site counts (rebuild with fresh data) ✅ No manual cache clearing needed after updates ✅ Users get correct data on fresh pull HOW IT WORKS: 1. User does: git pull origin dev 2. launcher.sh file is updated by git 3. Old .sysref.beta becomes outdated (older than launcher.sh) 4. Next launcher run detects this 5. Auto-clears cache automatically 6. Fresh detection and database rebuild happens 7. User gets CORRECT data TESTED: ✅ - Created old cache file - Made launcher.sh newer (simulated git pull) - Ran launcher --detect-only - Cache auto-cleared successfully --- launcher.sh | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/launcher.sh b/launcher.sh index 687bd8a..0c76b1e 100755 --- a/launcher.sh +++ b/launcher.sh @@ -689,6 +689,16 @@ init_directories() { } startup_detection() { + # Auto-clear cache if toolkit files are newer (fresh git pull) + # This ensures users always get fresh data after git updates + if [ -f "$BASE_DIR/.sysref.beta" ] && [ -f "$BASE_DIR/launcher.sh" ]; then + # If launcher.sh is newer than cache, it means git just pulled updates + # and we should rebuild cache with current code + if [ "$BASE_DIR/launcher.sh" -nt "$BASE_DIR/.sysref.beta" ]; then + rm -f "$BASE_DIR/.sysref.beta" "$BASE_DIR/.sysref.beta.timestamp" 2>/dev/null || true + fi + fi + # Initialize system detection first (required for show_system_overview) if [ -z "${SYS_DETECTION_COMPLETE:-}" ]; then initialize_system_detection