Add structured headers to the PHP include layer, fix monitor state paths

All 16 include/ files now carry PURPOSE / DESIGN PRINCIPLES / OPERATIONAL
SAFEGUARDS / EXPORTS / CONFIGURATION, keeping the first three section names
identical to the bash headers so retrieval can route across both languages.

monitor.php read six watchdog state files from /tmp while the watchdogs write
to STATE_DIR, so every strike set came back empty and the summary reported
healthy unconditionally. docs.php gained path containment before it is wired
to a page.
This commit is contained in:
Gmer4Lfe
2026-08-02 00:38:22 -04:00
parent 76c4ca5ccf
commit 43b5443b30
16 changed files with 811 additions and 21 deletions
+41
View File
@@ -1,4 +1,45 @@
<?php
// ═══════════════════════════════════════════════════════════════════════════════════════════════
// PURPOSE
// Maps each script to the conf subsections that configure it, parses those fields into
// form definitions, and writes edits back to the conf file. This is what lets the
// scheduler page edit a script's settings without the user opening master.conf.
//
// DESIGN PRINCIPLES
// Section headers in the conf are the schema.
// The map keys off the literal `# ━━━ Name ━━━` and `# ── Name ──` headers already in
// the conf files. Documentation structure and form structure are the same thing, so a
// new setting placed under an existing header appears in the UI with no code change.
//
// Edits are surgical, never a rewrite.
// Only the changed lines are replaced. Comments, ordering, spacing and every unrelated
// value survive untouched — these files are hand-maintained and heavily commented, and
// a regenerating writer would destroy that.
//
// Structure only; values are not validated.
// Consistent with conf_upgrade.sh, this reconciles shape and leaves correctness to the
// consuming script.
//
// OPERATIONAL SAFEGUARDS
// An unmatched section yields no fields rather than a wrong write.
// If the named subsection is not found the field list comes back empty and nothing is
// written. Guessing at a target line in a conf file is how an unrelated setting gets
// overwritten.
//
// Writes are confined to the parsed line range.
// Each field carries the exact line it came from, so a write cannot land outside the
// subsection it was read from.
//
// EXPORTS
// vv_conf_has_sections() does this script have an editable conf section
// vv_conf_parse_subsection() fields within one named subsection
// vv_conf_all_groups() every mapped group
// vv_conf_fields_for_script() form definition for one script
// vv_conf_write_changes() apply edits back to the conf file
//
// CONFIGURATION
// CONF_DIR master.conf and host*.conf are the read and write targets
// ═══════════════════════════════════════════════════════════════════════════════════════════════
require_once __DIR__ . '/config.php';
// confform.php — script→conf-section mapping, field parsing, and write-back.