Addresses review feedback (jmeyer26):
- update.php: move the sync_log table + dtfb_sync_url setting out of the
already-released <120 migration block into a new <121 block, so instances
already at version 120 actually receive them.
- script.php: create the sync_log table, seed dtfb_sync_url, and set the
fresh-install datenbank_version to 121 (parity with update.php).
Applies 6 fixes to sync.php found during QA of the player-sync feature:
1. Normalise non-UTF-8 (latin1/Win-1252) payloads -> fixes silent 0-row imports
2. Fail loudly (success=false) when N rows parse but nothing is added/updated
3. Remove dead \ block (undefined-variable notice)
4. Gate mass-deactivation: skip the sweep when a payload carries < 50% of an
org's currently-active members (configurable via sync_deactivation_min_ratio,
default 0.5); adds/updates still proceed, skipped sweeps return warnings
5. Use a single DB clock (NOW()) for staging session id/cleanup
6. Enforce Passnummer format ^[0-9]{2}-[0-9]{4,6}\$ (parity with manual import)
Adds tests/dtfb-player-sync/FINDINGS.md documenting the findings and fixes.
End-to-end validation is to be done on the staging environments.
Merge resolution:
- Combined migration 120 (sync_log table + dev branch schema changes)
Bug fixes from intensive code review:
- C1: Fix session_id type mismatch - use datetime format matching
the staging table schema instead of varchar string (was breaking
the entire sync receive import)
- C2: Fix staging table cleanup query - use datetime comparison
matching the original admin import pattern
- W1: Add set_time_limit(300) to prevent timeout during large imports
- W2: Add REDIRECT_HTTP_AUTHORIZATION header support for Apache
mod_rewrite compatibility
- W4: Add lizenz column parsing and update during sync import
- M1: Tighten export WHERE clause to require both aktueller_verein_id
and spielernr (consistent with original export behavior)
- M2: Wrap syncGetLastStatus() in try/catch for graceful handling
when sync_log table doesn't exist yet