Add cache clearing command to launcher
NEW FEATURE: - launcher.sh --clear-cache: Clear all stale cache and temp files - Clears .sysref.beta and .sysref.beta.timestamp - Clears temporary files in tmp/ directory - Auto-rebuilds cache on next run USAGE: bash launcher.sh --clear-cache SOLVES: - Users can now easily clear stale cache - WordPress site listings will update - Database/user listings will refresh - No more ghost entries from previous runs ADDED TO HELP: - Updated --help output with --clear-cache option - Usage examples included
This commit is contained in:
+46
@@ -780,13 +780,59 @@ main() {
|
|||||||
echo "═══════════════════════════════════════════════════════════════"
|
echo "═══════════════════════════════════════════════════════════════"
|
||||||
return 0
|
return 0
|
||||||
;;
|
;;
|
||||||
|
--clear-cache)
|
||||||
|
# Initialize directories first
|
||||||
|
init_directories || {
|
||||||
|
echo "ERROR: Failed to initialize directories"
|
||||||
|
return 1
|
||||||
|
}
|
||||||
|
|
||||||
|
# Clear all caches
|
||||||
|
local cache_cleared=0
|
||||||
|
|
||||||
|
# Production cache
|
||||||
|
if [ -f "$BASE_DIR/.sysref" ] || [ -f "$BASE_DIR/.sysref.timestamp" ]; then
|
||||||
|
rm -f "$BASE_DIR/.sysref" "$BASE_DIR/.sysref.timestamp" 2>/dev/null || true
|
||||||
|
echo "✓ Cleared production cache (.sysref)"
|
||||||
|
cache_cleared=1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Dev cache
|
||||||
|
if [ -f "$BASE_DIR/.sysref.beta" ] || [ -f "$BASE_DIR/.sysref.beta.timestamp" ]; then
|
||||||
|
rm -f "$BASE_DIR/.sysref.beta" "$BASE_DIR/.sysref.beta.timestamp" 2>/dev/null || true
|
||||||
|
echo "✓ Cleared dev cache (.sysref.beta)"
|
||||||
|
cache_cleared=1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Temp files
|
||||||
|
if [ -d "$BASE_DIR/tmp" ]; then
|
||||||
|
rm -rf "$BASE_DIR/tmp"/* 2>/dev/null || true
|
||||||
|
echo "✓ Cleared temporary files"
|
||||||
|
cache_cleared=1
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ $cache_cleared -eq 0 ]; then
|
||||||
|
echo "ℹ️ No cache files to clear"
|
||||||
|
else
|
||||||
|
echo ""
|
||||||
|
echo "Cache cleared successfully!"
|
||||||
|
echo "System will auto-detect and rebuild cache on next run."
|
||||||
|
fi
|
||||||
|
return 0
|
||||||
|
;;
|
||||||
--help|--usage|-h|-?)
|
--help|--usage|-h|-?)
|
||||||
echo "Usage: launcher.sh [OPTIONS]"
|
echo "Usage: launcher.sh [OPTIONS]"
|
||||||
echo ""
|
echo ""
|
||||||
echo "Options:"
|
echo "Options:"
|
||||||
echo " --detect-only Show system detection results and exit"
|
echo " --detect-only Show system detection results and exit"
|
||||||
|
echo " --clear-cache Clear all cache and temporary files"
|
||||||
echo " --help Show this help message"
|
echo " --help Show this help message"
|
||||||
echo ""
|
echo ""
|
||||||
|
echo "Examples:"
|
||||||
|
echo " bash launcher.sh --detect-only # Check what was detected"
|
||||||
|
echo " bash launcher.sh --clear-cache # Clear stale cache data"
|
||||||
|
echo " bash launcher.sh # Normal interactive mode"
|
||||||
|
echo ""
|
||||||
return 0
|
return 0
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|||||||
Reference in New Issue
Block a user