mirror of
https://codeberg.org/PostERG/xamxam.git
synced 2026-05-06 11:09:18 +02:00
Extract SystemController: centralise system page data logic, eliminate frag_ helper duplication
- Add src/SystemController.php (452 lines) encapsulating:
- runStatusChecks(): nginx, php-fpm, HTTP ping, SQLite DB, storage, maintenance flag
- getStatusData() / getPhpInfo() / getDiskInfo() with SystemCache TTL delegation
- getLogData(tab, n): log file tail reading + file metadata
- getNginxConfigData(): live-then-local nginx config reading
- Static helpers: logLineClass(), nginxLineClass(), statusLabel(), statusClass(),
humanBytes(), diskColor() — shared by both entry points
- invalidateAll() for ?refresh=1 cache busting
- Rewrite admin/system.php: 582 → 282 lines
- All free functions (safeExec, systemdStatus, localHttpCheck, humanBytes,
statusLabel, statusClass, logLineClass, nginxLineClass, readLogTail) removed
- Data sections replaced by controller method calls
- View template unchanged; now calls SystemController::statusClass() etc. directly
- Rewrite admin/system-fragment.php: 213 → 137 lines
- All duplicated frag_readLogTail(), frag_logLineClass(), frag_nginxLineClass()
helpers removed
- Now instantiates SystemController and delegates getLogData()/getNginxConfigData()
- Identical rendering logic preserved; constant references updated to
SystemController::LOG_FILES and SystemController::ALLOWED_LINES
No behaviour change; no CSS/JS changes.
This commit is contained in:
@@ -17,7 +17,7 @@
|
||||
## Controller Extraction (In Progress)
|
||||
|
||||
- [x] Extract `SearchController` — `src/SearchController.php`; rate-limiting, param sanitisation, DB queries, OG meta, and author-map construction moved out of `public/search.php`; entry point is now a 6-line dispatcher (`create()` + `handle()` + `extract()`); view template unchanged
|
||||
- [ ] Extract `SystemController` — biggest single-file win, 500→8 lines
|
||||
- [x] Extract `SystemController` — `src/SystemController.php` (452 lines); all status checks, disk/PHP info, log reading, nginx config reading, and line classifiers centralised; `system.php` reduced 582→282 lines; `system-fragment.php` reduced 213→137 lines with all duplicated `frag_*` helpers eliminated
|
||||
- [ ] Extract `ThesisEditController` — merges `edit.php` + `actions/edit.php`, deduplicates jury fieldset
|
||||
- [ ] Extract remaining controllers one by one
|
||||
- [ ] Consolidate action handlers into controller methods
|
||||
|
||||
Reference in New Issue
Block a user