1. Core Script (pihole_stats.sh)
-
Performance Architecture:
-
New: Merged calculations into single workers. Sorts data once, then performs instant lookups for Median/P95.
-
Impact: Dashboard generation with all options enabled is ~15% faster. CLI mode is slightly slower (single-threaded) but significantly more stable.
-
Database Stability:
-
New: Added
PRAGMA busy_timeout = 30000;to all SQL connections. The script now waits for the DB to be free instead of crashing immediately. -
New: Forced
WAL (Write-Ahead Log) Modewhen using Snapshots (-snap). This allows Readers and Writers to operate simultaneously, eliminating the "Database Locked" error.
2. Dashboard (dash.html)
- Objective Health Metrics:
- Old: Health Bar was calculated based on User Configured Tiers (Subjective).
- New: Health Bar is now calculated using Hardcoded SQL Logic (Objective).
- Result: Changing visual tiers (L01, L02) no longer breaks the accuracy of the Health score.
3. Cron Maker (cronmaker.sh)
-
Safety & Defaults:
-
Old: Read default settings from
pihole_stats.conf(which users might have broken). -
New: Uses Hardcoded Factory Defaults for Tiers and Logic to ensure new profiles are always valid. Reads installation paths from a read-only
.phls_defaultsfile. -
️Priority Injection:
-
New: Automatically appends
/usr/bin/nice -n 19 /usr/bin/ionice -c 3to every new Cron job it creates. -
Profile Management:
-
New: Explicitly handles
default.confvs custom profiles correctly, ensuring the Dashboard receives the correct-dash "ProfileName"argument.
4. Installer (install_phls.sh)
-
Auto-Patching:
-
New: Detects existing PHLS cron jobs on the system and injects
nice -n 19 ionice -c 3automatically during upgrade. -
Path Intelligence:
-
New: Generates a hidden file
.phls_defaultscontaining the validated installation paths (SAFE_INSTALL_DIR,SAFE_DASH_DIR). This bridges the gap between the Installer and Cron Maker. -
New: Updates the
pihole_stats.confDASH_DIRvariable usingsedif the user chooses a custom dashboard path.