fix: RemoteCP CustomPoints PHP-Warnungen behoben (undefined constants)

Bare-constant-Zugriffe (pt_custom, pt_points, ...) in CustomPoints/index.php
durch defined()-Prüfungen ersetzt, um PHP 7.2+ Warnungen zu vermeiden.
Zusätzlich werden im Produktivmodus (PHP_DISPLAY_ERRORS=false) Warnungen
und Notices in der PHP error_reporting unterdrückt.

- Gepatchte index.php als assets/config/remotecp/plugins/CustomPoints/index.php
- Dockerfile: COPY der gepatchten Datei statt fragiler sed-Patches
- RunTrackmaniaServer.sh: Auto-Patch für bestehende Volumes beim Container-Start
- error_reporting im Produktivmodus um ~E_WARNING & ~E_NOTICE ergänzt

Closes #4
This commit is contained in:
2026-03-22 01:09:37 +01:00
parent ffdc11a02b
commit 5891429c83
4 changed files with 161 additions and 2 deletions

View File

@@ -18,7 +18,7 @@ else
echo "==> PHP-Debug-Modus deaktiviert"
cat > "$PHP_INI_DIR/99-adminserv-debug.ini" <<EOF
display_errors = Off
error_reporting = E_ALL & ~E_DEPRECATED & ~E_STRICT
error_reporting = E_ALL & ~E_DEPRECATED & ~E_STRICT & ~E_WARNING & ~E_NOTICE
log_errors = On
error_log = /var/log/php_errors.log
EOF
@@ -353,6 +353,22 @@ if [ "$XASECO_ENABLED" = "true" ]; then
fi
fi
# ============================================================
# RemoteCP: PHP-Warnungen in Plugins fixen (fuer bestehende Volumes)
# ============================================================
# RemoteCP nutzt bare constants (pt_custom, pt_points, ...), die in
# PHP 7.2+ Warnungen ausloesen. Die gepatchte Datei aus dem Image
# wird in das Volume kopiert, falls die alte Version noch vorhanden ist.
# ============================================================
CUSTOMPOINTS_FILE="/var/www/html/remotecp/plugins/CustomPoints/index.php"
CUSTOMPOINTS_DEFAULT="/opt/tmserver/default-controlpanel/remotecp/plugins/CustomPoints/index.php"
if [ -f "$CUSTOMPOINTS_FILE" ] && ! grep -q 'defined.*pt_custom' "$CUSTOMPOINTS_FILE"; then
echo "==> Patche CustomPoints-Plugin (PHP-Warnungen beheben)..."
cp "$CUSTOMPOINTS_DEFAULT" "$CUSTOMPOINTS_FILE"
chown www-data:www-data "$CUSTOMPOINTS_FILE"
echo " CustomPoints-Plugin erfolgreich gepatcht."
fi
echo "Starting apache server"
service apache2 start