Add structured headers to the PHP pages layer

Documents each tab's purpose, what it renders, and which endpoints it polls.
Pages that start with markup get the header in a <?php ?> block so it never
reaches the browser.

Also corrects the layer diagram in README-unraid.md: eight of eleven pages hold
no PHP logic and poll api/ for everything — only auth, monitor and scheduler
require an include/ file directly.
This commit is contained in:
Gmer4Lfe
2026-08-02 00:51:41 -04:00
parent 0b4ff27be4
commit ccc6c742ee
12 changed files with 414 additions and 5 deletions
+59
View File
@@ -1,4 +1,63 @@
<?php
// ═══════════════════════════════════════════════════════════════════════════════════════════════
// PURPOSE
// Scheduler tab. The largest page in the plugin and the main operational surface: the full
// script library, per-job schedules, live run status and logs, dry-run output, conf editing
// per script, and the custom-script editor.
//
// OPERATIONAL MODEL
// Writes state that changes what the machine does on a timer. Enabling, disabling or
// rescheduling a job here takes effect on the next cron rebuild — this page decides what
// runs unattended at 1am.
//
// DESIGN PRINCIPLES
// Script descriptions come from the scripts themselves.
// Requires include/scheduler.php, which parses the PURPOSE block out of each bash
// header. The library listing and the script's own documentation are the same text and
// cannot drift. This page is the reason the repo-wide header convention exists.
//
// The job tree is derived from conf, not maintained here.
// Orchestrator job lists come from master.conf arrays; custom scripts are whatever
// *.sh sits in CUSTOM_SCRIPTS_DIR. Nothing has to be registered in two places.
//
// Long operations never block the page.
// Runs, dry-runs and imports go through api/run.php and api/dryrun.php with status
// polled separately, so a script that takes ten minutes does not hold a request open.
//
// OPERATIONAL SAFEGUARDS
// Running a script from the UI is confirmed first. Several of these delete files.
//
// Dry-run is offered alongside run for anything destructive, and its output is shown in
// full rather than summarised — reading the list is the point.
//
// Stale locks are cleared explicitly through api/clearlock.php, never automatically. A lock
// that looks stale may belong to a job still running.
//
// Conf edits are surgical, preserving the comment blocks that document every threshold.
//
// Custom scripts live outside the git repo, so a user's own scripts are never touched by a
// pull and never committed by accident.
//
// Script content and log output render escaped throughout — this page displays arbitrary
// file contents.
//
// RENDERS
// Job tree by orchestrator tier, per-job schedule and toggle controls, live status and
// logs, dry-run output, per-script conf forms, custom script editor, run history
//
// DEPENDS ON
// include/scheduler.php required directly — schedule, cron rebuild, script library
// api/scheduler.php schedule read/write api/run.php execute
// api/dryrun.php dry-run execute api/stop.php terminate
// api/status.php live run status api/log.php log tail
// api/script.php script read/write api/readscript.php source
// api/scriptinfo.php header metadata api/import_script.php
// api/conf_toggle.php per-script enable api/flag_toggle.php
// api/confform.php conf forms api/rawconf.php raw conf edit
// api/board.php overview board api/recent.php recent runs
// api/snapshot.php state snapshot api/clearlock.php stale lock clear
// api/savefolders.php folder grouping api/reorderarray.php
// api/rsync_standalone.php
require_once dirname(__DIR__) . '/include/scheduler.php';
// Setup mode — auto-open a conf file and force the editing sequence