2026-11-06 06:58:14 +01:00
#!/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 ] :
2026-11-06 06:58:24 +01:00
""" Letzter Commit, der den App-Code (tippspiel/) angefasst hat. """
2026-11-06 06:58:14 +01:00
try :
out = subprocess . run (
2026-11-06 06:58:24 +01:00
[ " git " , " log " , " -1 " , " --format= % h| %a d " , " --date=short " , " -- " , " tippspiel " ] ,
2026-11-06 06:58:14 +01:00
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 } ), "
2026-11-06 06:58:24 +01:00
f " letzter Commit an `tippspiel/`. \n "
2026-11-06 06:58:14 +01:00
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 ( ) )