mirror of
https://codeberg.org/PostERG/xamxam.git
synced 2026-05-06 19:19:19 +02:00
- 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.
32 lines
3.3 KiB
Markdown
32 lines
3.3 KiB
Markdown
# PHP Components (Reusable Partials)
|
|
|
|
## Form field partials — `templates/partials/form/`
|
|
|
|
- [x] **`text-field.php`** — already implemented; used across `add.php` and `edit.php` for all single-line fields
|
|
- [x] **`select-field.php`** — already implemented; used for orientation, ap, finality, license, access type, etc.
|
|
- [x] **`checkbox-list.php`** — already implemented with `<fieldset>/<legend class="sr-only">/<ul>` structure for WCAG 1.3.1
|
|
- [x] **`file-field.php`** — already implemented; used for cover image, banner, and TFE files
|
|
- [x] **`jury-fieldset.php`** — already implemented; single partial shared by `add.php` and `edit.php`; includes all WCAG aria-labels and JS for dynamic rows
|
|
|
|
## Shared UI partials — `templates/partials/`
|
|
|
|
- [x] **`pagination.php`** — partial created and used in both `search.php` and (now) `admin/index.php`; `admin/index.php` also gained proper server-side pagination (25/page) with filter-aware `$baseParams`
|
|
- [x] **`status-badge.php`** — partial fully implemented (`templates/partials/status-badge.php`) with `$badgeType`/`$badgeValue` API; CSS rules in `admin.css`; used in `admin/index.php` for publish + access badges
|
|
- [x] **`admin-alert.php`** — already done; `flash-messages.php` calls `App::consumeFlash()` which handles all legacy key variants (`_flash_error`, `error`, `admin_error`, `edit_error`, `form_error`, `success`, `admin_success`, `edit_success`) and clears them all
|
|
|
|
## 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
|
|
- [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
|
|
- [x] Unify flash message keys project-wide to `_flash_error` / `_flash_success` — all callers already use `App::flash()`; removed dead legacy-key fallback chains (`error`, `admin_error`, `edit_error`, `form_error`, `success`, `admin_success`, `edit_success`) from `consumeFlash()`
|
|
- [ ] Move OG tag construction into controller logic
|
|
- [x] Extract inline CSS/JS from `system.php` into separate assets — JS moved to `public/assets/js/system.js` (loaded via `$extraJs`); 4 inline `style=` attributes replaced with CSS classes; only dynamic CSS custom properties (`--disk-pct`, `--disk-color`) remain as inline styles because they carry PHP runtime values
|
|
|
|
## Backend Maintenance
|
|
|
|
- [x] **`RateLimit` cache dir** — already in `storage/cache/rate_limit`; `justfile` deploy excludes `storage/cache/*` from rsync. APCu/SQLite migration deferred (not blocking).
|
|
- [x] **`apropos.php` contacts and credits** — moved to `config/apropos.php` config array (`contacts[]`, `credits[]`, `erg_url`); `apropos.php` loops over the config with `htmlspecialchars`; update names/emails by editing only the config file
|