Code-Map und Suchfilter ergänzen: gleiche Einsicht bei weniger Tokens
- docs/code-map.md: generierte Landkarte mit Routen (?page= → View), Zweck und öffentlichen Methoden je Datei sowie "Wo finde ich was?". - tools/gen_codemap.py: erzeugt die Map aus dem Code, --check erkennt veraltete Stände; Zweck-Texte werden im PURPOSE-Dict gepflegt. - .ignore/.gitignore: docs/legacy/ bleibt versioniert, wird aber nicht mehr von grep/glob durchsucht (8 MB alter Laravel-Stand). - AGENTS.md: verweist auf die Map und beschreibt gezieltes Lesen.
This commit is contained in:
parent
4016348500
commit
aac9f605d3
5 changed files with 643 additions and 0 deletions
4
.gitignore
vendored
4
.gitignore
vendored
|
|
@ -5,3 +5,7 @@ tools/.env
|
|||
live_credentials.txt
|
||||
tools/dumps/
|
||||
__pycache__/
|
||||
|
||||
# Alter Laravel-Stand: bleibt versioniert, wird aber aus Suche/Glob ausgeblendet
|
||||
# (siehe .ignore). Nicht löschen, nur nicht mehr durchsuchen.
|
||||
docs/legacy/
|
||||
|
|
|
|||
6
.ignore
Normal file
6
.ignore
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
# Von Suche und Glob ausschließen (ripgrep-basiert, unabhängig vom Git-Index).
|
||||
# Die Dateien bleiben versioniert; sie sollen nur nicht in Suchtreffern und
|
||||
# Dateilisten auftauchen. Siehe docs/code-map.md.
|
||||
docs/legacy/
|
||||
tools/dumps/
|
||||
__pycache__/
|
||||
14
AGENTS.md
14
AGENTS.md
|
|
@ -18,6 +18,20 @@
|
|||
- **Zugangsdaten:** `docs/live_credentials.txt` und `tools/.env` sind gitignored.
|
||||
Inhalte nicht ausgeben und nicht committen.
|
||||
|
||||
## Orientierung im Code
|
||||
|
||||
- **Erst `docs/code-map.md` lesen**, dann gezielt öffnen. Dort stehen Routen
|
||||
(`?page=` → View), Zweck und öffentliche Methoden je Datei sowie „Wo finde ich was?“.
|
||||
Nur den passenden Abschnitt lesen (`grep -n '^## ' docs/code-map.md`).
|
||||
- **Die Map wird generiert:** nach Strukturänderungen `tools/gen_codemap.py` ausführen
|
||||
(oder `--check` als Vergleich). Zweck-Texte im `PURPOSE`-Dict pflegen, nicht die Map.
|
||||
- **`docs/legacy/` ist per `.ignore` ausgeblendet** (alter Laravel-Stand, nur Referenz).
|
||||
Bei Bedarf gezielt mit Pfadangabe durchsuchen.
|
||||
- **Gezielt statt breit lesen:** erst `wc -l`/`grep -n`, dann `read` mit `offset`/`limit`.
|
||||
Logs und SQL-Dumps am Ursprung aggregieren (`zcat … | awk`, `mysql -e "…"`) statt roh
|
||||
ausgeben; `git log --stat`/`--oneline` statt voller Diffs.
|
||||
- `tools/schema.sql` beschreibt die Tabellen; `tools/dumps/` sind gitignored.
|
||||
|
||||
## Betriebsdiagnose
|
||||
|
||||
- **Bei „Spieler kommen nicht auf die Seite“ zuerst `docs/betriebsdiagnose.md` lesen.**
|
||||
|
|
|
|||
164
docs/code-map.md
Normal file
164
docs/code-map.md
Normal file
|
|
@ -0,0 +1,164 @@
|
|||
# Code-Map
|
||||
|
||||
> Automatisch erzeugt von `tools/gen_codemap.py`. Basis: `46d05ac` (2026-11-04), letzter Commit an `tippspiel/` oder `tools/`.
|
||||
> Nicht von Hand ändern: Zweck-Texte im `PURPOSE`-Dict des Generators pflegen,
|
||||
> danach `tools/gen_codemap.py` ausführen (oder `--check` in CI).
|
||||
|
||||
Diese Datei ersetzt die Erkundung. Erst hier nachschlagen, dann gezielt mit
|
||||
`grep -n` und `read` (offset/limit) öffnen — es reicht, den passenden
|
||||
Abschnitt zu lesen. `docs/legacy/` ist absichtlich ausgeblendet (siehe
|
||||
`.ignore`); dort liegt der alte Laravel-Stand.
|
||||
|
||||
Umfang: 11261 Zeilen in 66 Dateien.
|
||||
|
||||
## Einstiegspunkte
|
||||
|
||||
| Datei | Zeilen | Zweck |
|
||||
|---|---|---|
|
||||
| `tippspiel/public/index.php` | 1195 | Front-Controller; Routing ist eine if/elseif-Kette auf `?page=` |
|
||||
| `tippspiel/src/autoload.php` | 26 | PSR-4-artiger Autoloader für `App\` |
|
||||
| `tools/schema.sql` | 204 | Schema der neuen DB (Tabellen, Indizes) |
|
||||
| `tippspiel/public/sw.js` | 114 | Service Worker für Web-Push |
|
||||
|
||||
## Routen (`?page=…`)
|
||||
|
||||
| page | Zugriff | View | ab Zeile |
|
||||
|--------------------------|---------|------------------------------------------------------------------------------------------|----------|
|
||||
| `reminder` | — | (Textausgabe) | 54 |
|
||||
| `fetch_results` | — | (Textausgabe) | 71 |
|
||||
| `login` | — | `login` | 86 |
|
||||
| `register` | — | `register`, `login` | 107 |
|
||||
| `logout` | — | — | 181 |
|
||||
| `tipp_game` | Login | `tipps/game` (Fallback) | 185 |
|
||||
| `tipps` | Login | `tipps/index` | 205 |
|
||||
| `tipp_round` | Login | `tipps/round` | 226 |
|
||||
| `datenschutz` | — | `info/privacy` | 297 |
|
||||
| `guide` | Login | `info/guide` | 300 |
|
||||
| `guide_admin` | Admin | `info/guide_admin` | 311 |
|
||||
| `info_quotas` | Login | `info/quotas` | 316 |
|
||||
| `money_ranking` | Login | `tipps/no_payment`, `info/no_ranking`, `info/money_ranking_detail`, `info/money_ranking` | 328 |
|
||||
| `admin_accounts` | Admin | `admin/accounts` | 360 |
|
||||
| `admin_message` | Admin | `admin/message` | 373 |
|
||||
| `admin_fetcher_activity` | Admin | `admin/fetcher_activity` | 391 |
|
||||
| `push_subscribe` | Login | (JSON) | 406 |
|
||||
| `push_unsubscribe` | Login | — | 433 |
|
||||
| `push_test` | Login | — | 439 |
|
||||
| `settings` | Login | `settings` | 508 |
|
||||
| `admin` | Admin | — | 556 |
|
||||
| `admin_seasons` | Admin | `admin/seasons` | 580 |
|
||||
| `admin_rounds` | Admin | `admin/rounds` | 690 |
|
||||
| `admin_roundmails` | Admin | `admin/roundmails` | 798 |
|
||||
| `admin_users` | Admin | `admin/users` | 865 |
|
||||
| `round` | Login | `round` | 969 |
|
||||
| `ranking` | Login | `ranking` | 1028 |
|
||||
| `questions` | Login | `questions` | 1093 |
|
||||
| `home` | Login | `home` | 1156 |
|
||||
|
||||
Alle übrigen Pfade laufen auf `home` bzw. 404. Reihenfolge und Bedingungen
|
||||
stehen in `tippspiel/public/index.php`. `(Fallback)` markiert Seiten eines
|
||||
`in_array`-Zweigs ohne eigene `$page ===`-Prüfung; `(JSON)` sind Endpunkte
|
||||
ohne View.
|
||||
|
||||
## Core (`App\Core`)
|
||||
|
||||
| Datei | Zeilen | Zweck | öffentliche Methoden |
|
||||
|----------------------------------------|--------|------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
|
||||
| `tippspiel/src/Core/Auth.php` | 112 | Session, Login/Logout, Rollenprüfung (requireLogin/requireAdmin) | `start()`, `login($firstname, $lastname, $password)`, `logout()`, `check()`, `id()`, `user()`, `isAdmin()`, `requireLogin()`, … |
|
||||
| `tippspiel/src/Core/Crypto.php` | 127 | Symmetrische Verschlüsselung sensibler Felder (IBAN), Schlüssel aus IBAN_KEY | `key()`, `isEncrypted($value)`, `encrypt($plaintext)`, `decrypt($value)`, `maskIban($iban)` |
|
||||
| `tippspiel/src/Core/Database.php` | 38 | PDO-Singleton, Verbindung aus DB_*-Umgebungsvariablen | `getInstance()`, `getConnection()` |
|
||||
| `tippspiel/src/Core/ErrorHandler.php` | 75 | Globale Fehlerbehandlung: Log + lesbare Fehlerseite statt leerem 500 | `register()`, `handleException($e)`, `handleFatal()`, `render()` |
|
||||
| `tippspiel/src/Core/ErrorLog.php` | 52 | PHP-Fehlerdatei außerhalb des Web-Roots, Rotation bei 5 MB | `path()`, `rotateIfNeeded($maxBytes)` |
|
||||
| `tippspiel/src/Core/Iban.php` | 51 | IBAN normalisieren und prüfen | `normalize($value)`, `isValid($value)` |
|
||||
| `tippspiel/src/Core/Mailer.php` | 159 | Minimaler SMTP-Client ohne externe Abhängigkeiten | `send($recipients, $subject, $html, $replyTo)` |
|
||||
| `tippspiel/src/Core/ResultFetcher.php` | 535 | Ergebnisse von openligadb und API-Football holen und eintragen | `openligadb($apply, $check)`, `apifootball($apply, $check)` |
|
||||
| `tippspiel/src/Core/WebPush.php` | 446 | Web-Push (VAPID, RFC 8291) ohne externe Abhängigkeiten | `isConfigured()`, `publicKey()`, `subject()`, `isValidEndpoint($endpoint)`, `isValidKeyMaterial($p256dh, $auth)`, `send($subscription, $payload)`, `encrypt($payload, $p256dh, $auth, $salt, …)` |
|
||||
|
||||
## Models (`App\Models`)
|
||||
|
||||
| Datei | Zeilen | Zweck | öffentliche Methoden |
|
||||
|---------------------------------------------|--------|--------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
|
||||
| `tippspiel/src/Models/FetcherLog.php` | 65 | Protokoll des Ergebnis-Fetchers | `create($action, $message)`, `getRange($fromDate, $toDate)`, `deleteOld()` |
|
||||
| `tippspiel/src/Models/Game.php` | 93 | Spiele lesen, Sperre 1 Minute vor Anpfiff, Ergebnisse | `isLocked($kickoffTime)`, `getResultString($score1, $score2, $kickoffTime)`, `getGamesByRound($roundId)`, `getById($id)`, `update($id, $data)` |
|
||||
| `tippspiel/src/Models/Payment.php` | 44 | Zahlungen je Saison (user_id -> paid_date) | `getPaymentsBySeason($seasonId)`, `setPaidStatus($userId, $seasonId, $hasPaid)` |
|
||||
| `tippspiel/src/Models/PushSubscription.php` | 195 | Push-Abos der Spieler | `isAvailable()`, `hasSubscription($userId)`, `save($userId, $endpoint, $p256dh, $auth)`, `findForUserAndEndpoint($userId, $endpoint)`, `deleteForUser($userId)`, `deleteByEndpoint($endpoint)`, `getForUsers($userIds)`, `sendReminder($userIds, $payload)` |
|
||||
| `tippspiel/src/Models/Question.php` | 164 | Spielerfragen an die Admins inklusive Antworten | `create($userId, $question)`, `findByUser($userId)`, `findAllForAdmin()`, `findById($id)`, `answer($id, $answer, $adminId)`, `hasNewAnswer($userId)`, `hasOpenQuestion()`, `markAnswersSeen($userId)`, … |
|
||||
| `tippspiel/src/Models/Quota.php` | 171 | Ausschüttungsbeträge einer Saison (aus Legacy portiert) | `computePayouts($seasonId)`, `get6Divisor($number)`, `getBySeason($seasonId)`, `getMapBySeason($seasonId)`, `editableNames()`, `defaults()`, `validate($quotas)`, `saveForSeason($seasonId, $quotas)` |
|
||||
| `tippspiel/src/Models/Ranking.php` | 623 | Rangliste, Tagessieg, Ausschüttungen einer Saison | `compute($seasonId, $maxRoundId)`, `roundTable($result)`, `payoutItems($result)`, `roundSummary($result)`, `getJackpotStatus($seasonId)`, `computeForMoneyRanking($seasonId)`, `moneyRanking($result, $withBankData)` |
|
||||
| `tippspiel/src/Models/Round.php` | 182 | Runden lesen, Reihenfolge, erste tippbare Runde | `getById($id)`, `getBySeason($seasonId)`, `updateName($id, $name)`, `updateReport($id, $report)`, `reportToText($report)`, `getLockTime($games)`, `isCompleted($games)`, `isLocked($games)`, … |
|
||||
| `tippspiel/src/Models/Roundmail.php` | 310 | Rundmail-Protokoll und Erinnerungsversand | `count($excludeReminders)`, `getPage($limit, $offset, $excludeReminders)`, `findById($id)`, `create($userId, $recipients, $topic, $messageHtml, …)`, `textToHtml($text)`, `parseRecipients($list)`, `recipientGroups($seasonId, $tippableRound)`, `sendReminder($appUrl)`, … |
|
||||
| `tippspiel/src/Models/Season.php` | 280 | Saisons; global aktive Saison aus settings.current_season_id | `getCurrent()`, `getViewSeason()`, `viewSeasonId()`, `setViewSeason($id)`, `getAll()`, `findById($id)`, `create($data)`, `update($id, $data)`, … |
|
||||
| `tippspiel/src/Models/Setting.php` | 80 | Systemeinstellungen aus der settings-Tabelle | `isRegistrationOpen()`, `setRegistrationOpen($open)`, `getMessage()`, `setMessage($message)` |
|
||||
| `tippspiel/src/Models/Team.php` | 227 | Mannschaften mit Aliasen und Logo | `normalize($name)`, `findByAlias($name)`, `resolve($name)`, `suggest($name, $limit)`, `findById($id)`, `logoUrl($team)`, `logoExists($team)`, `logoMap($ids)`, … |
|
||||
| `tippspiel/src/Models/Tipp.php` | 497 | Tipps speichern und Punkte werten (aus Legacy portiert) | `getScoreLocal($goals1, $goals2, $tipp1, $tipp2, …)`, `isExact($goals1, $goals2, $tipp1, $tipp2)`, `getCol($goals1, $goals2, $tipp1, $tipp2, …)`, `evaluateRound($games, $tippsByGameId)`, `compareDayScore($a, $b)`, `findByUserAndRound($userId, $roundId)`, `findByRound($roundId)`, `getJokerUsage($userId, $seasonId, $excludeRoundId, $upToRoundId)`, … |
|
||||
| `tippspiel/src/Models/User.php` | 407 | Benutzer, Kontodaten (IBAN verschlüsselt), Löschfristen | `findByEmail($email)`, `findByFirstAndLastName($firstname, $lastname)`, `findById($id)`, `getProfileWarnings($userId)`, `nameExists($firstname, $lastname, $excludeId)`, `emailExists($email, $excludeId)`, `countAll()`, `getAll()`, … |
|
||||
|
||||
## Views (`tippspiel/src/Views`)
|
||||
|
||||
| Datei | Zeilen | Zweck |
|
||||
|-----------------------------------------------------|--------|--------------------------------------------------------------|
|
||||
| `tippspiel/src/Views/admin/accounts.php` | 108 | Konto- und Ausschüttungsübersicht |
|
||||
| `tippspiel/src/Views/admin/fetcher_activity.php` | 64 | Protokoll des Ergebnis-Fetchers |
|
||||
| `tippspiel/src/Views/admin/message.php` | 34 | Mitteilung an alle Spieler setzen |
|
||||
| `tippspiel/src/Views/admin/roundmails.php` | 212 | Rundmails verfassen und versenden |
|
||||
| `tippspiel/src/Views/admin/rounds.php` | 206 | Spiele und Ergebnisse eintragen |
|
||||
| `tippspiel/src/Views/admin/seasons.php` | 217 | Saisons verwalten |
|
||||
| `tippspiel/src/Views/admin/users.php` | 190 | Benutzer verwalten (inkl. Tipp-/Joker-Lücken) |
|
||||
| `tippspiel/src/Views/error.php` | 34 | Fehlerseite (vom ErrorHandler genutzt) |
|
||||
| `tippspiel/src/Views/home.php` | 87 | Startseite: Begrüßung und abgeschlossene Runden |
|
||||
| `tippspiel/src/Views/info/guide.php` | 207 | Anleitung für Spieler |
|
||||
| `tippspiel/src/Views/info/guide_admin.php` | 144 | Anleitung für Admins |
|
||||
| `tippspiel/src/Views/info/money_ranking.php` | 49 | Geldrangliste |
|
||||
| `tippspiel/src/Views/info/money_ranking_detail.php` | 44 | Ausschüttungsdetails je Spieler |
|
||||
| `tippspiel/src/Views/info/no_ranking.php` | 14 | Hinweis, solange keine Rangliste vorliegt |
|
||||
| `tippspiel/src/Views/info/privacy.php` | 84 | Datenschutzerklärung |
|
||||
| `tippspiel/src/Views/info/quotas.php` | 61 | Quoten und Ausschüttung der Saison |
|
||||
| `tippspiel/src/Views/login.php` | 55 | Login-Formular |
|
||||
| `tippspiel/src/Views/partials/footer.php` | 32 | Seitenabschluss und Skripte |
|
||||
| `tippspiel/src/Views/partials/header.php` | 101 | HTML-Kopf, Navigation inkl. Admin-Menü und Saison-Umschalter |
|
||||
| `tippspiel/src/Views/questions.php` | 138 | Fragen der Spieler und Admin-Antworten |
|
||||
| `tippspiel/src/Views/ranking.php` | 433 | Rangliste (Runde/Saison) inkl. Joker-Wertung |
|
||||
| `tippspiel/src/Views/register.php` | 81 | Registrierung inkl. Zahlungshinweis |
|
||||
| `tippspiel/src/Views/round.php` | 101 | Tippübersicht aller Spieler bis zu einer Runde |
|
||||
| `tippspiel/src/Views/settings.php` | 293 | Eigene Daten: IBAN/PayPal/Mobilnummer, E-Mail, Erinnerungen |
|
||||
| `tippspiel/src/Views/tipps/game.php` | 80 | Tipp-Formular für ein einzelnes Spiel |
|
||||
| `tippspiel/src/Views/tipps/index.php` | 99 | Tipp-Startseite: Runden mit Spielen, eigenen Tipps und Joker |
|
||||
| `tippspiel/src/Views/tipps/no_payment.php` | 9 | Hinweis auf offene Zahlung vor der Tippabgabe |
|
||||
| `tippspiel/src/Views/tipps/round.php` | 105 | Rundenliste mit Spielen, Tipps und Joker |
|
||||
|
||||
## Werkzeuge (`tools/`)
|
||||
|
||||
| Datei | Zeilen | Zweck | öffentliche Methoden |
|
||||
|---------------------------------------|--------|--------------------------------------------------------------------|----------------------|
|
||||
| `tools/clear_account_fields.php` | 59 | Kontofelder aller Benutzer leeren (nach Export) | — |
|
||||
| `tools/encrypt_ibans.php` | 65 | IBAN-Klartexte verschlüsseln (idempotent) | — |
|
||||
| `tools/export_accounts.php` | 114 | Kontodaten der aktiven Spieler als CSV exportieren | — |
|
||||
| `tools/fetch_results_apifootball.php` | 19 | CLI-Wrapper: Ergebnisse Länderspiele/Europapokal | — |
|
||||
| `tools/fetch_results_openligadb.php` | 19 | CLI-Wrapper: Ergebnisse Bundesliga/DFB-Pokal | — |
|
||||
| `tools/import.php` | 135 | Legacy-Dump in die neue DB importieren (tote Features ausgelassen) | — |
|
||||
| `tools/import_accounts.php` | 291 | Kontodaten-CSV in users importieren | — |
|
||||
| `tools/migrate_users_paypal.php` | 75 | Schema-Migration: bankname/blz/kontonr -> paypal | — |
|
||||
| `tools/seed_teams.php` | 363 | Mannschaften/Aliase anlegen und Spiele zuordnen | — |
|
||||
| `tools/test_webpush_rfc8291.php` | 62 | Testnachricht für Web-Push | — |
|
||||
| `tools/deploy_live.py` | 745 | Deploy per FTP; --db-sync/--db-only nur nach Bestätigung | — |
|
||||
| `tools/dump_tippspiel.py` | 220 | Live-DB nach tools/dumps sichern (14 Dumps werden behalten) | — |
|
||||
| `tools/fetch_logos.py` | 299 | Vereinslogos (Wikipedia) und Flaggen (flagcdn) laden | — |
|
||||
| `tools/gen_codemap.py` | 455 | Erzeugt docs/code-map.md: eine kompakte Landkarte der Codebase. | — |
|
||||
| `tools/generate_vapid_keys.py` | 125 | VAPID-Schlüssel für Web-Push erzeugen | — |
|
||||
|
||||
## Wo finde ich was?
|
||||
|
||||
- **Neue Seite / Route** → `tippspiel/public/index.php` (if/elseif auf `?page=`), View unter `tippspiel/src/Views/`
|
||||
- **Login, Session, Rechte** → `Core/Auth.php`
|
||||
- **Tippabgabe und Sperre** → `Models/Game.php` (`isLocked`), `Models/Tipp.php`, `Views/tipps/*`
|
||||
- **Punkte und Rangliste** → `Models/Ranking.php`, `Models/Tipp.php`, `Views/ranking.php`
|
||||
- **Ausschüttung und Quoten** → `Models/Quota.php`, `Views/info/quotas.php`
|
||||
- **Zahlungen** → `Models/Payment.php`, `Views/admin/accounts.php`
|
||||
- **Ergebnisse holen (Cron)** → `Core/ResultFetcher.php`, `?page=fetch_results`, `tools/fetch_results_*.php`
|
||||
- **Erinnerungsmails (Cron)** → `Models/Roundmail.php`, `?page=reminder`, `Core/Mailer.php`
|
||||
- **App-Erinnerungen / Push** → `Core/WebPush.php`, `Models/PushSubscription.php`, `public/sw.js`
|
||||
- **IBAN und Verschlüsselung** → `Core/Crypto.php`, `Core/Iban.php`, `tools/encrypt_ibans.php`
|
||||
- **Import aus dem Legacy-Dump** → `tools/import.php`, danach `tools/seed_teams.php`
|
||||
- **Live-Deploy** → `tools/deploy_live.py`
|
||||
- **DB-Dumps** → `tools/dump_tippspiel.py` (Ziel `tools/dumps/`, gitignored)
|
||||
- **Fehlerlog und Betrieb** → `Core/ErrorLog.php`, `Core/ErrorHandler.php`, `docs/betriebsdiagnose.md`
|
||||
- **Alter Laravel-Stand (nur Referenz)** → `docs/legacy/`
|
||||
455
tools/gen_codemap.py
Executable file
455
tools/gen_codemap.py
Executable file
|
|
@ -0,0 +1,455 @@
|
|||
#!/usr/bin/env python3
|
||||
"""Erzeugt docs/code-map.md: eine kompakte Landkarte der Codebase.
|
||||
|
||||
Zweck: Statt bei jeder Aufgabe mehrere Dateien zu öffnen, um zu verstehen,
|
||||
wo was liegt, wird eine kurze Map gelesen (~2 KB) und danach gezielt
|
||||
gegrept. Die Map wird aus dem Quellcode generiert, damit sie nicht veraltet.
|
||||
|
||||
Aufruf:
|
||||
./gen_codemap.py # schreibt docs/code-map.md
|
||||
./gen_codemap.py --check # Exitcode 1, wenn die Datei veraltet ist
|
||||
|
||||
Kuratiert werden nur die PURPOSE-Texte (unten) und der Abschnitt
|
||||
"Wo finde ich was?"; alles andere kommt aus dem Code. Nach dem Ändern von
|
||||
Dateien/ Methoden einfach neu erzeugen.
|
||||
"""
|
||||
|
||||
import re
|
||||
import subprocess
|
||||
import sys
|
||||
from pathlib import Path
|
||||
|
||||
ROOT = Path(__file__).resolve().parent.parent
|
||||
OUT = ROOT / "docs" / "code-map.md"
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
# Kuration: Zweck je Datei. Nur nötig, wo der Code keinen brauchbaren
|
||||
# Kommentar am Dateianfang hat (Views, Tools) oder der erste Kommentar
|
||||
# irreführend ist.
|
||||
# ---------------------------------------------------------------------------
|
||||
PURPOSE = {
|
||||
"tippspiel/public/index.php": "Front-Controller: Routing über ?page=, Session, Fehlerbehandlung, Cron-Routen",
|
||||
"tippspiel/public/sw.js": "Service Worker für Web-Push",
|
||||
"tippspiel/public/css/style.css": "Globales CSS (eine Datei, keine Build-Pipeline)",
|
||||
|
||||
# Core
|
||||
"tippspiel/src/Core/Auth.php": "Session, Login/Logout, Rollenprüfung (requireLogin/requireAdmin)",
|
||||
"tippspiel/src/Core/Database.php": "PDO-Singleton, Verbindung aus DB_*-Umgebungsvariablen",
|
||||
"tippspiel/src/Core/Crypto.php": "Symmetrische Verschlüsselung sensibler Felder (IBAN), Schlüssel aus IBAN_KEY",
|
||||
"tippspiel/src/Core/ErrorHandler.php": "Globale Fehlerbehandlung: Log + lesbare Fehlerseite statt leerem 500",
|
||||
"tippspiel/src/Core/ErrorLog.php": "PHP-Fehlerdatei außerhalb des Web-Roots, Rotation bei 5 MB",
|
||||
"tippspiel/src/Core/Iban.php": "IBAN normalisieren und prüfen",
|
||||
"tippspiel/src/Core/Mailer.php": "Minimaler SMTP-Client ohne externe Abhängigkeiten",
|
||||
"tippspiel/src/Core/ResultFetcher.php": "Ergebnisse von openligadb und API-Football holen und eintragen",
|
||||
"tippspiel/src/Core/WebPush.php": "Web-Push (VAPID, RFC 8291) ohne externe Abhängigkeiten",
|
||||
|
||||
# Models
|
||||
"tippspiel/src/Models/Game.php": "Spiele lesen, Sperre 1 Minute vor Anpfiff, Ergebnisse",
|
||||
"tippspiel/src/Models/Round.php": "Runden lesen, Reihenfolge, erste tippbare Runde",
|
||||
"tippspiel/src/Models/Season.php": "Saisons; global aktive Saison aus settings.current_season_id",
|
||||
"tippspiel/src/Models/User.php": "Benutzer, Kontodaten (IBAN verschlüsselt), Löschfristen",
|
||||
"tippspiel/src/Models/Quota.php": "Ausschüttungsbeträge einer Saison (aus Legacy portiert)",
|
||||
"tippspiel/src/Models/Ranking.php": "Rangliste, Tagessieg, Ausschüttungen einer Saison",
|
||||
"tippspiel/src/Models/Tipp.php": "Tipps speichern und Punkte werten (aus Legacy portiert)",
|
||||
"tippspiel/src/Models/Payment.php": "Zahlungen je Saison (user_id -> paid_date)",
|
||||
"tippspiel/src/Models/PushSubscription.php": "Push-Abos der Spieler",
|
||||
"tippspiel/src/Models/Question.php": "Spielerfragen an die Admins inklusive Antworten",
|
||||
"tippspiel/src/Models/Roundmail.php": "Rundmail-Protokoll und Erinnerungsversand",
|
||||
"tippspiel/src/Models/Setting.php": "Systemeinstellungen aus der settings-Tabelle",
|
||||
"tippspiel/src/Models/Team.php": "Mannschaften mit Aliasen und Logo",
|
||||
"tippspiel/src/Models/FetcherLog.php": "Protokoll des Ergebnis-Fetchers",
|
||||
|
||||
# Views
|
||||
"tippspiel/src/Views/home.php": "Startseite: Begrüßung und abgeschlossene Runden",
|
||||
"tippspiel/src/Views/login.php": "Login-Formular",
|
||||
"tippspiel/src/Views/register.php": "Registrierung inkl. Zahlungshinweis",
|
||||
"tippspiel/src/Views/settings.php": "Eigene Daten: IBAN/PayPal/Mobilnummer, E-Mail, Erinnerungen",
|
||||
"tippspiel/src/Views/questions.php": "Fragen der Spieler und Admin-Antworten",
|
||||
"tippspiel/src/Views/ranking.php": "Rangliste (Runde/Saison) inkl. Joker-Wertung",
|
||||
"tippspiel/src/Views/round.php": "Tippübersicht aller Spieler bis zu einer Runde",
|
||||
"tippspiel/src/Views/error.php": "Fehlerseite (vom ErrorHandler genutzt)",
|
||||
"tippspiel/src/Views/partials/header.php": "HTML-Kopf, Navigation inkl. Admin-Menü und Saison-Umschalter",
|
||||
"tippspiel/src/Views/partials/footer.php": "Seitenabschluss und Skripte",
|
||||
"tippspiel/src/Views/tipps/index.php": "Tipp-Startseite: Runden mit Spielen, eigenen Tipps und Joker",
|
||||
"tippspiel/src/Views/tipps/round.php": "Rundenliste mit Spielen, Tipps und Joker",
|
||||
"tippspiel/src/Views/tipps/game.php": "Tipp-Formular für ein einzelnes Spiel",
|
||||
"tippspiel/src/Views/tipps/no_payment.php": "Hinweis auf offene Zahlung vor der Tippabgabe",
|
||||
"tippspiel/src/Views/info/guide.php": "Anleitung für Spieler",
|
||||
"tippspiel/src/Views/info/guide_admin.php": "Anleitung für Admins",
|
||||
"tippspiel/src/Views/info/privacy.php": "Datenschutzerklärung",
|
||||
"tippspiel/src/Views/info/quotas.php": "Quoten und Ausschüttung der Saison",
|
||||
"tippspiel/src/Views/info/money_ranking.php": "Geldrangliste",
|
||||
"tippspiel/src/Views/info/money_ranking_detail.php": "Ausschüttungsdetails je Spieler",
|
||||
"tippspiel/src/Views/info/no_ranking.php": "Hinweis, solange keine Rangliste vorliegt",
|
||||
"tippspiel/src/Views/admin/accounts.php": "Konto- und Ausschüttungsübersicht",
|
||||
"tippspiel/src/Views/admin/fetcher_activity.php": "Protokoll des Ergebnis-Fetchers",
|
||||
"tippspiel/src/Views/admin/message.php": "Mitteilung an alle Spieler setzen",
|
||||
"tippspiel/src/Views/admin/rounds.php": "Spiele und Ergebnisse eintragen",
|
||||
"tippspiel/src/Views/admin/roundmails.php": "Rundmails verfassen und versenden",
|
||||
"tippspiel/src/Views/admin/seasons.php": "Saisons verwalten",
|
||||
"tippspiel/src/Views/admin/users.php": "Benutzer verwalten (inkl. Tipp-/Joker-Lücken)",
|
||||
|
||||
# Tools
|
||||
"tools/deploy_live.py": "Deploy per FTP; --db-sync/--db-only nur nach Bestätigung",
|
||||
"tools/dump_tippspiel.py": "Live-DB nach tools/dumps sichern (14 Dumps werden behalten)",
|
||||
"tools/fetch_logos.py": "Vereinslogos (Wikipedia) und Flaggen (flagcdn) laden",
|
||||
"tools/generate_vapid_keys.py": "VAPID-Schlüssel für Web-Push erzeugen",
|
||||
"tools/import.php": "Legacy-Dump in die neue DB importieren (tote Features ausgelassen)",
|
||||
"tools/import_accounts.php": "Kontodaten-CSV in users importieren",
|
||||
"tools/export_accounts.php": "Kontodaten der aktiven Spieler als CSV exportieren",
|
||||
"tools/clear_account_fields.php": "Kontofelder aller Benutzer leeren (nach Export)",
|
||||
"tools/encrypt_ibans.php": "IBAN-Klartexte verschlüsseln (idempotent)",
|
||||
"tools/seed_teams.php": "Mannschaften/Aliase anlegen und Spiele zuordnen",
|
||||
"tools/migrate_users_paypal.php": "Schema-Migration: bankname/blz/kontonr -> paypal",
|
||||
"tools/fetch_results_openligadb.php": "CLI-Wrapper: Ergebnisse Bundesliga/DFB-Pokal",
|
||||
"tools/fetch_results_apifootball.php": "CLI-Wrapper: Ergebnisse Länderspiele/Europapokal",
|
||||
"tools/test_webpush_rfc8291.php": "Testnachricht für Web-Push",
|
||||
"tools/schema.sql": "Schema der neuen Datenbank",
|
||||
"tools/migration_push_subscriptions.sql": "Migration: Tabelle push_subscriptions",
|
||||
}
|
||||
|
||||
IGNORED_DIRS = {"docs/legacy", "tools/dumps", "__pycache__", ".git"}
|
||||
|
||||
FUNC_RE = re.compile(r"public\s+(?:static\s+)?function\s+(\w+)\s*\(([^)]*)\)", re.S)
|
||||
ROUTE_RE = re.compile(r"\$page\s*===\s*'([a-z_0-9]+)'(.*?)\)\s*\{\s*$")
|
||||
GROUP_RE = re.compile(r"in_array\(\s*\$page\s*,\s*\[([^\]]*)\][^;]*\)\s*\{\s*$")
|
||||
VIEW_RE = re.compile(r"require\s+__DIR__\s*\.\s*'/\.\./src/Views/([^']+)\.php'")
|
||||
|
||||
|
||||
def rel(path: Path) -> str:
|
||||
return str(path.relative_to(ROOT))
|
||||
|
||||
|
||||
def read_text(path: Path) -> str:
|
||||
return path.read_text(encoding="utf-8", errors="replace")
|
||||
|
||||
|
||||
def strip_code(line: str) -> str:
|
||||
"""Entfernt Strings und Kommentare, damit Klammern korrekt gezählt werden."""
|
||||
line = re.sub(r"'(?:\\.|[^'\\])*'", "''", line)
|
||||
line = re.sub(r'"(?:\\.|[^"\\])*"', '""', line)
|
||||
line = re.sub(r"//.*$", "", line)
|
||||
line = re.sub(r"/\*.*?\*/", "", line)
|
||||
return line
|
||||
|
||||
|
||||
def first_sentence(block: str) -> str:
|
||||
for raw in block.splitlines():
|
||||
line = raw.strip().lstrip("*").strip()
|
||||
if not line or line.startswith("@") or line.startswith("/**"):
|
||||
continue
|
||||
return line.rstrip(".") + "."
|
||||
return ""
|
||||
|
||||
|
||||
def php_class_doc(text: str) -> str:
|
||||
m = re.search(r"/\*\*(.*?)\*/\s*(?:final\s+|abstract\s+)?class\s+\w+", text, re.S)
|
||||
if m:
|
||||
return first_sentence(m.group(1))
|
||||
return ""
|
||||
|
||||
|
||||
def php_first_doc(text: str) -> str:
|
||||
m = re.search(r"/\*\*(.*?)\*/", text, re.S)
|
||||
if m:
|
||||
return first_sentence(m.group(1))
|
||||
for line in text.splitlines():
|
||||
s = line.strip()
|
||||
if s.startswith("//") and s not in ("//", "// <?php"):
|
||||
return s[2:].strip().rstrip(".") + "."
|
||||
return ""
|
||||
|
||||
|
||||
def php_public_methods(text: str) -> list[str]:
|
||||
out = []
|
||||
for name, args in FUNC_RE.findall(text):
|
||||
if name.startswith("__"):
|
||||
continue
|
||||
parts = []
|
||||
for arg in args.split(","):
|
||||
arg = arg.strip()
|
||||
if not arg:
|
||||
continue
|
||||
arg = arg.split("=")[0].strip()
|
||||
token = arg.split()[-1]
|
||||
if token:
|
||||
parts.append(token)
|
||||
if len(parts) > 4:
|
||||
sig = ", ".join(parts[:4]) + ", …"
|
||||
else:
|
||||
sig = ", ".join(parts)
|
||||
out.append(f"{name}({sig})")
|
||||
return out
|
||||
|
||||
|
||||
def py_info(text: str) -> tuple[str, list[str]]:
|
||||
desc = ""
|
||||
m = re.match(r'#!.*?\n(?:#.*\n)*\s*"""(.*?)"""', text, re.S)
|
||||
if m:
|
||||
desc = first_sentence(m.group(1))
|
||||
funcs = re.findall(r"^def\s+(\w+)\s*\(([^)]*)\)", text, re.M)
|
||||
methods = []
|
||||
for name, args in funcs:
|
||||
if name.startswith("_"):
|
||||
continue
|
||||
parts = [a.strip().split("=")[0].split(":")[0].strip() for a in args.split(",") if a.strip()]
|
||||
methods.append(f"{name}({', '.join(parts)})" if parts else f"{name}()")
|
||||
return desc, methods
|
||||
|
||||
|
||||
def line_count(path: Path) -> int:
|
||||
try:
|
||||
return len(read_text(path).splitlines())
|
||||
except OSError:
|
||||
return 0
|
||||
|
||||
|
||||
def block_end(lines: list[str], start: int) -> int:
|
||||
"""Endzeile des Blocks, der in `start` mit '{' beginnt (verschachtelt gezählt).
|
||||
|
||||
Schließende Klammern werden vor öffnenden gezählt, damit `} elseif (…) {`
|
||||
einer if/elseif-Kette den Block korrekt beendet und nicht weiterläuft.
|
||||
"""
|
||||
depth = 1
|
||||
for j in range(start + 1, len(lines)):
|
||||
code = strip_code(lines[j])
|
||||
depth -= code.count("}")
|
||||
if depth <= 0:
|
||||
return j
|
||||
depth += code.count("{")
|
||||
return len(lines) - 1
|
||||
|
||||
|
||||
def block_access(body: str) -> str:
|
||||
if "Auth::requireAdmin()" in body:
|
||||
return "Admin"
|
||||
if "Auth::requireLogin()" in body:
|
||||
return "Login"
|
||||
# JSON-Endpunkte antworten selbst mit 401 statt umzuleiten.
|
||||
if "http_response_code(401)" in body:
|
||||
return "Login"
|
||||
return "—"
|
||||
|
||||
|
||||
def collect_routes(index_text: str) -> list[dict]:
|
||||
lines = index_text.splitlines()
|
||||
headers = []
|
||||
|
||||
for i, line in enumerate(lines):
|
||||
m = ROUTE_RE.search(line)
|
||||
g = GROUP_RE.search(line)
|
||||
if not m and not g:
|
||||
continue
|
||||
end = block_end(lines, i)
|
||||
body = "\n".join(lines[i:end + 1])
|
||||
views = []
|
||||
for v in VIEW_RE.findall(body):
|
||||
if v not in views:
|
||||
views.append(v)
|
||||
entry = {
|
||||
"line": i + 1,
|
||||
"end": end,
|
||||
"access": block_access(body),
|
||||
"views": views,
|
||||
"text": "text/plain" in body,
|
||||
}
|
||||
if m:
|
||||
entry["kind"] = "route"
|
||||
entry["pages"] = [m.group(1)]
|
||||
entry["condition"] = f"page={m.group(1)}" + (f" {m.group(2).strip()}" if m.group(2).strip() else "")
|
||||
else:
|
||||
entry["kind"] = "group"
|
||||
entry["pages"] = re.findall(r"'([a-z_0-9]+)'", g.group(1))
|
||||
entry["condition"] = "page=" + "|".join(entry["pages"])
|
||||
headers.append(entry)
|
||||
|
||||
rank = {"—": 0, "Login": 1, "Admin": 2}
|
||||
|
||||
def inherited(h):
|
||||
best = "—"
|
||||
for other in headers:
|
||||
if other["kind"] == "group" and other["line"] < h["line"] <= other["end"]:
|
||||
if rank[other["access"]] > rank[best]:
|
||||
best = other["access"]
|
||||
return best
|
||||
|
||||
# Erst die konkreten Zweige, dann Gruppen nur für Seiten ohne eigenen Zweig.
|
||||
rows, seen = [], set()
|
||||
for h in sorted((x for x in headers if x["kind"] == "route"), key=lambda x: x["line"]):
|
||||
access = h["access"] if rank[h["access"]] >= rank[inherited(h)] else inherited(h)
|
||||
page = h["pages"][0]
|
||||
rows.append({
|
||||
"page": page,
|
||||
"access": access,
|
||||
"view": ", ".join(f"`{v}`" for v in h["views"]) or ("(Textausgabe)" if h["text"] else "—"),
|
||||
"line": h["line"],
|
||||
})
|
||||
seen.add(page)
|
||||
|
||||
for h in sorted((x for x in headers if x["kind"] == "group"), key=lambda x: x["line"]):
|
||||
for page in h["pages"]:
|
||||
if page in seen:
|
||||
continue
|
||||
seen.add(page)
|
||||
fallback = f"`{h['views'][-1]}` (Fallback)" if h["views"] else "(JSON)"
|
||||
rows.append({"page": page, "access": h["access"], "view": fallback, "line": h["line"]})
|
||||
|
||||
rows.sort(key=lambda r: r["line"])
|
||||
return rows
|
||||
|
||||
|
||||
def md_table(headers: list[str], rows: list[list[str]]) -> str:
|
||||
widths = [len(h) for h in headers]
|
||||
for row in rows:
|
||||
for k, cell in enumerate(row):
|
||||
widths[k] = max(widths[k], len(cell))
|
||||
def fmt(cells):
|
||||
return "| " + " | ".join(c.ljust(widths[k]) for k, c in enumerate(cells)) + " |"
|
||||
out = [fmt(headers), "|" + "|".join("-" * (w + 2) for w in widths) + "|"]
|
||||
out.extend(fmt(r) for r in rows)
|
||||
return "\n".join(out)
|
||||
|
||||
|
||||
def git_commit() -> tuple[str, str]:
|
||||
"""Letzter Commit, der Code (tippspiel/ oder tools/) angefasst hat."""
|
||||
try:
|
||||
out = subprocess.run(
|
||||
["git", "log", "-1", "--format=%h|%ad", "--date=short", "--", "tippspiel", "tools"],
|
||||
cwd=ROOT, capture_output=True, text=True, check=True).stdout.strip()
|
||||
if "|" in out:
|
||||
sha, date = out.split("|", 1)
|
||||
return sha, date
|
||||
except (OSError, subprocess.CalledProcessError):
|
||||
pass
|
||||
return "unbekannt", "unbekannt"
|
||||
|
||||
|
||||
def normalize(text: str) -> str:
|
||||
"""Blendet die Stand-Zeile aus, damit --check nach einem Commit stabil bleibt."""
|
||||
return re.sub(r"^> Basis: .*$", "> Basis: <normalisiert>", text, flags=re.M)
|
||||
|
||||
|
||||
def main() -> int:
|
||||
sha, date = git_commit()
|
||||
|
||||
php_core = sorted((ROOT / "tippspiel/src/Core").glob("*.php"))
|
||||
php_models = sorted((ROOT / "tippspiel/src/Models").glob("*.php"))
|
||||
php_views = sorted((ROOT / "tippspiel/src/Views").rglob("*.php"))
|
||||
tools_php = sorted((ROOT / "tools").glob("*.php"))
|
||||
tools_py = sorted((ROOT / "tools").glob("*.py"))
|
||||
|
||||
def row(path: Path, desc: str, methods: list[str] | None) -> list[str]:
|
||||
m = ""
|
||||
if methods:
|
||||
m = ", ".join(f"`{x}`" for x in methods[:8])
|
||||
if len(methods) > 8:
|
||||
m += ", …"
|
||||
return [f"`{rel(path)}`", str(line_count(path)), desc or "—", m or "—"]
|
||||
|
||||
core_rows, model_rows, view_rows, tool_rows = [], [], [], []
|
||||
|
||||
for path in php_core + php_models:
|
||||
text = read_text(path)
|
||||
desc = PURPOSE.get(rel(path)) or php_class_doc(text) or php_first_doc(text)
|
||||
(core_rows if path.parent.name == "Core" else model_rows).append(
|
||||
row(path, desc, php_public_methods(text)))
|
||||
|
||||
for path in php_views:
|
||||
text = read_text(path)
|
||||
desc = PURPOSE.get(rel(path))
|
||||
if not desc:
|
||||
m = re.search(r"<h1>(.*?)</h1>", text, re.S)
|
||||
desc = re.sub(r"<[^>]+>|\s+", " ", m.group(1)).strip() if m else ""
|
||||
view_rows.append([f"`{rel(path)}`", str(line_count(path)), desc or "—"])
|
||||
|
||||
for path in tools_php + tools_py:
|
||||
text = read_text(path)
|
||||
if path.suffix == ".py":
|
||||
auto, _ = py_info(text)
|
||||
else:
|
||||
auto = php_first_doc(text)
|
||||
tool_rows.append(row(path, PURPOSE.get(rel(path)) or auto, None))
|
||||
|
||||
index_text = read_text(ROOT / "tippspiel/public/index.php")
|
||||
routes = collect_routes(index_text)
|
||||
route_rows = [[f"`{r['page']}`", r["access"], r["view"], str(r["line"])] for r in routes]
|
||||
|
||||
total_lines = sum(line_count(p) for p in php_core + php_models + php_views + tools_php + tools_py)
|
||||
|
||||
parts = [
|
||||
"# Code-Map\n",
|
||||
f"> Automatisch erzeugt von `tools/gen_codemap.py`. Basis: `{sha}` ({date}), "
|
||||
f"letzter Commit an `tippspiel/` oder `tools/`.\n"
|
||||
f"> Nicht von Hand ändern: Zweck-Texte im `PURPOSE`-Dict des Generators pflegen,\n"
|
||||
f"> danach `tools/gen_codemap.py` ausführen (oder `--check` in CI).\n",
|
||||
"Diese Datei ersetzt die Erkundung. Erst hier nachschlagen, dann gezielt mit\n"
|
||||
"`grep -n` und `read` (offset/limit) öffnen — es reicht, den passenden\n"
|
||||
"Abschnitt zu lesen. `docs/legacy/` ist absichtlich ausgeblendet (siehe\n"
|
||||
"`.ignore`); dort liegt der alte Laravel-Stand.\n",
|
||||
f"Umfang: {total_lines} Zeilen in {len(core_rows) + len(model_rows) + len(view_rows) + len(tool_rows)} Dateien.\n",
|
||||
"## Einstiegspunkte\n",
|
||||
"| Datei | Zeilen | Zweck |\n|---|---|---|\n"
|
||||
+ "\n".join([
|
||||
f"| `tippspiel/public/index.php` | {line_count(ROOT / 'tippspiel/public/index.php')} | Front-Controller; Routing ist eine if/elseif-Kette auf `?page=` |",
|
||||
f"| `tippspiel/src/autoload.php` | {line_count(ROOT / 'tippspiel/src/autoload.php')} | PSR-4-artiger Autoloader für `App\\` |",
|
||||
"| `tools/schema.sql` | "
|
||||
+ str(line_count(ROOT / 'tools/schema.sql'))
|
||||
+ " | Schema der neuen DB (Tabellen, Indizes) |",
|
||||
"| `tippspiel/public/sw.js` | "
|
||||
+ str(line_count(ROOT / 'tippspiel/public/sw.js'))
|
||||
+ " | Service Worker für Web-Push |",
|
||||
]) + "\n",
|
||||
"## Routen (`?page=…`)\n",
|
||||
md_table(["page", "Zugriff", "View", "ab Zeile"], route_rows) + "\n",
|
||||
"Alle übrigen Pfade laufen auf `home` bzw. 404. Reihenfolge und Bedingungen\n"
|
||||
"stehen in `tippspiel/public/index.php`. `(Fallback)` markiert Seiten eines\n"
|
||||
"`in_array`-Zweigs ohne eigene `$page ===`-Prüfung; `(JSON)` sind Endpunkte\n"
|
||||
"ohne View.\n",
|
||||
"## Core (`App\\Core`)\n",
|
||||
md_table(["Datei", "Zeilen", "Zweck", "öffentliche Methoden"], core_rows) + "\n",
|
||||
"## Models (`App\\Models`)\n",
|
||||
md_table(["Datei", "Zeilen", "Zweck", "öffentliche Methoden"], model_rows) + "\n",
|
||||
"## Views (`tippspiel/src/Views`)\n",
|
||||
md_table(["Datei", "Zeilen", "Zweck"], view_rows) + "\n",
|
||||
"## Werkzeuge (`tools/`)\n",
|
||||
md_table(["Datei", "Zeilen", "Zweck", "öffentliche Methoden"], tool_rows) + "\n",
|
||||
"## Wo finde ich was?\n",
|
||||
"\n".join([
|
||||
"- **Neue Seite / Route** → `tippspiel/public/index.php` (if/elseif auf `?page=`), View unter `tippspiel/src/Views/`",
|
||||
"- **Login, Session, Rechte** → `Core/Auth.php`",
|
||||
"- **Tippabgabe und Sperre** → `Models/Game.php` (`isLocked`), `Models/Tipp.php`, `Views/tipps/*`",
|
||||
"- **Punkte und Rangliste** → `Models/Ranking.php`, `Models/Tipp.php`, `Views/ranking.php`",
|
||||
"- **Ausschüttung und Quoten** → `Models/Quota.php`, `Views/info/quotas.php`",
|
||||
"- **Zahlungen** → `Models/Payment.php`, `Views/admin/accounts.php`",
|
||||
"- **Ergebnisse holen (Cron)** → `Core/ResultFetcher.php`, `?page=fetch_results`, `tools/fetch_results_*.php`",
|
||||
"- **Erinnerungsmails (Cron)** → `Models/Roundmail.php`, `?page=reminder`, `Core/Mailer.php`",
|
||||
"- **App-Erinnerungen / Push** → `Core/WebPush.php`, `Models/PushSubscription.php`, `public/sw.js`",
|
||||
"- **IBAN und Verschlüsselung** → `Core/Crypto.php`, `Core/Iban.php`, `tools/encrypt_ibans.php`",
|
||||
"- **Import aus dem Legacy-Dump** → `tools/import.php`, danach `tools/seed_teams.php`",
|
||||
"- **Live-Deploy** → `tools/deploy_live.py`",
|
||||
"- **DB-Dumps** → `tools/dump_tippspiel.py` (Ziel `tools/dumps/`, gitignored)",
|
||||
"- **Fehlerlog und Betrieb** → `Core/ErrorLog.php`, `Core/ErrorHandler.php`, `docs/betriebsdiagnose.md`",
|
||||
"- **Alter Laravel-Stand (nur Referenz)** → `docs/legacy/`",
|
||||
]) + "\n",
|
||||
]
|
||||
|
||||
content = "\n".join(parts)
|
||||
if "--check" in sys.argv:
|
||||
try:
|
||||
current = read_text(OUT)
|
||||
except OSError:
|
||||
current = ""
|
||||
if normalize(current) != normalize(content):
|
||||
print(f"{rel(OUT)} ist veraltet. Bitte tools/gen_codemap.py ausführen.")
|
||||
return 1
|
||||
print(f"{rel(OUT)} ist aktuell.")
|
||||
return 0
|
||||
|
||||
OUT.write_text(content, encoding="utf-8")
|
||||
print(f"{rel(OUT)} geschrieben: {len(content.splitlines())} Zeilen, "
|
||||
f"{len(content.encode('utf-8'))} Bytes, Stand {sha}.")
|
||||
return 0
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
raise SystemExit(main())
|
||||
Loading…
Add table
Add a link
Reference in a new issue