Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
7578e72334 | ||
|
|
8b6a34e8d1 | ||
|
|
96798c2db6 | ||
|
|
9f8f0f00d6 | ||
|
|
1ecb6c93b3 | ||
|
|
b13b524ad5 | ||
|
|
5ca2f1587f |
No files matched your search
+6
-6
@@ -1,15 +1,11 @@
|
|||||||
FROM debian:bullseye-slim
|
# Debian 13 Trixie liefert PHP 8.4 mit regulaeren Security-Updates
|
||||||
|
FROM debian:trixie-slim
|
||||||
|
|
||||||
RUN mkdir /opt/tmserver
|
RUN mkdir /opt/tmserver
|
||||||
|
|
||||||
WORKDIR /opt/tmserver
|
WORKDIR /opt/tmserver
|
||||||
|
|
||||||
# Alle benoetigten Pakete in einem Layer installieren und Cache aufraeumen
|
# Alle benoetigten Pakete in einem Layer installieren und Cache aufraeumen
|
||||||
# Debian Bullseye Archive-Repositories konfigurieren (Bullseye ist archiviert)
|
|
||||||
RUN echo "deb http://archive.debian.org/debian bullseye main" > /etc/apt/sources.list \
|
|
||||||
&& echo "deb http://archive.debian.org/debian-security bullseye-security main" >> /etc/apt/sources.list \
|
|
||||||
&& echo "Acquire::Check-Valid-Until false;" > /etc/apt/apt.conf.d/99no-check-valid-until
|
|
||||||
|
|
||||||
RUN apt-get update && apt-get install -y --no-install-recommends \
|
RUN apt-get update && apt-get install -y --no-install-recommends \
|
||||||
unzip \
|
unzip \
|
||||||
apache2 \
|
apache2 \
|
||||||
@@ -53,6 +49,10 @@ COPY assets/bin/RunTrackmaniaServer.sh /opt/tmserver/
|
|||||||
RUN sed -i 's/\r$//' /opt/tmserver/RunTrackmaniaServer.sh \
|
RUN sed -i 's/\r$//' /opt/tmserver/RunTrackmaniaServer.sh \
|
||||||
&& chmod +x /opt/tmserver/RunTrackmaniaServer.sh
|
&& chmod +x /opt/tmserver/RunTrackmaniaServer.sh
|
||||||
|
|
||||||
|
# PHP-8-Kompatibilitaet: ergaenzt __construct() fuer PHP-4-Konstruktoren
|
||||||
|
# (wird bei jedem Start auf die Volumes angewendet)
|
||||||
|
COPY assets/bin/Php8Compat.php /opt/tmserver/
|
||||||
|
|
||||||
COPY assets/bin/XAsecoHealthcheck.sh /opt/tmserver/
|
COPY assets/bin/XAsecoHealthcheck.sh /opt/tmserver/
|
||||||
RUN sed -i 's/\r$//' /opt/tmserver/XAsecoHealthcheck.sh \
|
RUN sed -i 's/\r$//' /opt/tmserver/XAsecoHealthcheck.sh \
|
||||||
&& chmod +x /opt/tmserver/XAsecoHealthcheck.sh
|
&& chmod +x /opt/tmserver/XAsecoHealthcheck.sh
|
||||||
|
|||||||
@@ -34,6 +34,19 @@ Alle Komponenten laufen in einem einzigen Container und werden über Umgebungsva
|
|||||||
|
|
||||||
Der Server unterstützt sowohl den **Internet-Dedicated-Modus** (Standard) als auch den **LAN-Dedicated-Modus**.
|
Der Server unterstützt sowohl den **Internet-Dedicated-Modus** (Standard) als auch den **LAN-Dedicated-Modus**.
|
||||||
|
|
||||||
|
## ⚠️ PHP 8 – bitte lesen (ab v1.4.0)
|
||||||
|
|
||||||
|
Seit **v1.4.0** basiert das Image auf **Debian 13 (Trixie) mit PHP 8.4**. PHP 7.4 ist seit 2022 ohne Sicherheitsupdates und von kritischen Lücken wie *PHP2Shell* (CVE-2026-109618, CVE-2026-109619) betroffen – deshalb habe ich den Umstieg vorgenommen.
|
||||||
|
|
||||||
|
AdminServ, RemoteCP und XAseco stammen allerdings aus PHP-5-Zeiten. Damit sie unter PHP 8 laufen, patcht der Container sie beim Start automatisch (PHP-4-Konstruktoren, veraltete Syntax, statische Aufrufe und einige bekannte Laufzeitfehler). Die Anpassungen sind idempotent und greifen auch bei bestehenden Volumes.
|
||||||
|
|
||||||
|
Ich habe die gängigen Funktionen getestet, aber **es kann durchaus noch zu Fehlern kommen** – vor allem in selten genutzten Plugins oder Menüs. Wenn dir etwas auffällt (weiße Seite, HTTP 500, XAseco-Absturz, Funktion ohne Wirkung), eröffne bitte ein [Issue](https://git.techniverse.net/scriptos/tmserver-docker/issues) und gib möglichst an:
|
||||||
|
|
||||||
|
- was du gemacht hast (Seite/Plugin/Chat-Befehl) und ungefähr wann,
|
||||||
|
- die passende Meldung aus `docker logs tmserver`, dem Apache-Log (`docker exec tmserver tail -n 50 /var/log/apache2/error.log`), `data/xaseco/aseco.log` oder `data/controlpanel/remotecp/cache/errors.log`.
|
||||||
|
|
||||||
|
Ich schaue mir das dann an. Wer PHP 7.4 behalten möchte, bleibt vorerst beim Image-Tag `1.3.3`.
|
||||||
|
|
||||||
## 🚀 Schnellstart
|
## 🚀 Schnellstart
|
||||||
|
|
||||||
### 1. Umgebungsvariablen einrichten
|
### 1. Umgebungsvariablen einrichten
|
||||||
|
|||||||
@@ -0,0 +1,325 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* Php8Compat.php - PHP-8-Kompatibilitaet fuer AdminServ, RemoteCP und XAseco
|
||||||
|
*
|
||||||
|
* Aufruf: php Php8Compat.php <verzeichnis> [<verzeichnis> ...]
|
||||||
|
*
|
||||||
|
* PHP 8 behandelt Methoden mit dem Namen der Klasse (PHP-4-Konstruktoren)
|
||||||
|
* nicht mehr als Konstruktor. Die alten Tools nutzen das an vielen Stellen,
|
||||||
|
* Objekte blieben dadurch uninitialisiert.
|
||||||
|
*
|
||||||
|
* Fuer jede Klasse mit PHP-4-Konstruktor und ohne __construct() wird direkt
|
||||||
|
* nach der oeffnenden Klammer ein __construct() eingefuegt, der die alte
|
||||||
|
* Methode aufruft. Die alte Methode bleibt erhalten, damit Aufrufe wie
|
||||||
|
* parent::IXR_Client(...) weiter funktionieren.
|
||||||
|
*
|
||||||
|
* Ausserdem werden String-Offsets mit geschweiften Klammern ($str{0}) auf
|
||||||
|
* eckige Klammern umgestellt (unter PHP 8 ein Parse-Error).
|
||||||
|
*
|
||||||
|
* Nicht-statische Methoden, die statisch aufgerufen werden (Core::getObject()),
|
||||||
|
* sind unter PHP 8 ein Fatal Error. Solche Methoden werden als static markiert,
|
||||||
|
* sofern sie $this nicht verwenden und keine Unterklasse sie nicht-statisch
|
||||||
|
* ueberschreibt.
|
||||||
|
*
|
||||||
|
* Idempotent: Klassen mit vorhandenem __construct() werden uebersprungen.
|
||||||
|
* Dateien werden in-place geschrieben (Besitzer und Rechte bleiben erhalten).
|
||||||
|
*/
|
||||||
|
|
||||||
|
if ($argc < 2) {
|
||||||
|
fwrite(STDERR, "Aufruf: php {$argv[0]} <verzeichnis> [...]\n");
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
$files = array();
|
||||||
|
for ($i = 1; $i < $argc; $i++) {
|
||||||
|
if (!is_dir($argv[$i])) continue;
|
||||||
|
$it = new RecursiveIteratorIterator(new RecursiveDirectoryIterator($argv[$i], FilesystemIterator::SKIP_DOTS));
|
||||||
|
foreach ($it as $file) {
|
||||||
|
if (strtolower($file->getExtension()) === 'php') $files[] = $file->getPathname();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$changed = array();
|
||||||
|
$totalClasses = 0;
|
||||||
|
$totalCurly = 0;
|
||||||
|
$totalStatic = 0;
|
||||||
|
|
||||||
|
// Durchlauf 1: Konstruktoren und String-Offsets (pro Datei)
|
||||||
|
foreach ($files as $path) {
|
||||||
|
$src = file_get_contents($path);
|
||||||
|
if ($src === false) continue;
|
||||||
|
list($new, $count) = patchConstructors($src);
|
||||||
|
list($new, $curly) = patchCurlyOffsets($new);
|
||||||
|
if ($new !== $src) {
|
||||||
|
file_put_contents($path, $new);
|
||||||
|
$changed[$path] = true;
|
||||||
|
$totalClasses += $count;
|
||||||
|
$totalCurly += $curly;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Durchlauf 2: statisch aufgerufene Methoden (dateiuebergreifend)
|
||||||
|
foreach (patchStaticCalls($files) as $path => $count) {
|
||||||
|
$changed[$path] = true;
|
||||||
|
$totalStatic += $count;
|
||||||
|
}
|
||||||
|
|
||||||
|
echo " PHP-8-Kompatibilitaet: $totalClasses Konstruktor(en), $totalCurly Offset(s), $totalStatic static-Methode(n) in " . count($changed) . " Datei(en) angepasst.\n";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Markiert nicht-statische Methoden als static, wenn sie irgendwo als
|
||||||
|
* Klasse::methode() aufgerufen werden, $this nicht verwenden und von keiner
|
||||||
|
* Unterklasse nicht-statisch ueberschrieben werden.
|
||||||
|
*
|
||||||
|
* Liefert [Pfad => Anzahl geaenderter Methoden].
|
||||||
|
*/
|
||||||
|
function patchStaticCalls($files)
|
||||||
|
{
|
||||||
|
$methods = array(); // "klasse::methode" => [pfad, token-index, static, usesThis]
|
||||||
|
$parents = array(); // "klasse" => "elternklasse"
|
||||||
|
$calls = array(); // "klasse::methode" => true
|
||||||
|
$tokensByFile = array();
|
||||||
|
|
||||||
|
foreach ($files as $path) {
|
||||||
|
$src = file_get_contents($path);
|
||||||
|
if ($src === false || strpos($src, '::') === false && stripos($src, 'class') === false) continue;
|
||||||
|
$t = @token_get_all($src);
|
||||||
|
$tokensByFile[$path] = $t;
|
||||||
|
$n = count($t);
|
||||||
|
$depth = 0;
|
||||||
|
$cls = null;
|
||||||
|
$clsDepth = -1;
|
||||||
|
for ($i = 0; $i < $n; $i++) {
|
||||||
|
$x = $t[$i];
|
||||||
|
if ($x === '{' || (is_array($x) && in_array($x[0], array(T_CURLY_OPEN, T_DOLLAR_OPEN_CURLY_BRACES), true))) {
|
||||||
|
$depth++;
|
||||||
|
} elseif ($x === '}') {
|
||||||
|
$depth--;
|
||||||
|
if ($depth === $clsDepth) { $cls = null; $clsDepth = -1; }
|
||||||
|
} elseif (is_array($x) && $x[0] === T_CLASS) {
|
||||||
|
$prev = prevSignificant($t, $i);
|
||||||
|
if ($prev !== null && is_array($t[$prev]) && in_array($t[$prev][0], array(T_DOUBLE_COLON, T_NEW), true)) continue;
|
||||||
|
$j = nextSignificant($t, $i);
|
||||||
|
if ($j !== null && is_array($t[$j]) && $t[$j][0] === T_STRING) {
|
||||||
|
$cls = strtolower($t[$j][1]);
|
||||||
|
$clsDepth = $depth;
|
||||||
|
$e = nextSignificant($t, $j);
|
||||||
|
if ($e !== null && is_array($t[$e]) && $t[$e][0] === T_EXTENDS) {
|
||||||
|
$pc = nextSignificant($t, $e);
|
||||||
|
if ($pc !== null && is_array($t[$pc])) $parents[$cls] = strtolower(ltrim($t[$pc][1], '\\'));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} elseif ($cls !== null && is_array($x) && $x[0] === T_FUNCTION && $depth === $clsDepth + 1) {
|
||||||
|
$static = false;
|
||||||
|
for ($k = $i - 1; $k >= 0; $k--) {
|
||||||
|
if (is_array($t[$k]) && $t[$k][0] === T_STATIC) $static = true;
|
||||||
|
if ($t[$k] === ';' || $t[$k] === '{' || $t[$k] === '}') break;
|
||||||
|
}
|
||||||
|
$j = nextSignificant($t, $i);
|
||||||
|
if ($j !== null && $t[$j] === '&') $j = nextSignificant($t, $j);
|
||||||
|
if ($j === null || !is_array($t[$j])) continue;
|
||||||
|
$m = strtolower($t[$j][1]);
|
||||||
|
$usesThis = false;
|
||||||
|
$k = $j;
|
||||||
|
while ($k < $n && $t[$k] !== '{' && $t[$k] !== ';') $k++;
|
||||||
|
if ($k < $n && $t[$k] === '{') {
|
||||||
|
$d = 0;
|
||||||
|
for ($q = $k; $q < $n; $q++) {
|
||||||
|
$y = $t[$q];
|
||||||
|
if ($y === '{' || (is_array($y) && in_array($y[0], array(T_CURLY_OPEN, T_DOLLAR_OPEN_CURLY_BRACES), true))) $d++;
|
||||||
|
elseif ($y === '}') { $d--; if ($d === 0) break; }
|
||||||
|
elseif (is_array($y) && $y[0] === T_VARIABLE && $y[1] === '$this') $usesThis = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$methods["$cls::$m"] = array($path, $i, $static, $usesThis);
|
||||||
|
} elseif (is_array($x) && $x[0] === T_DOUBLE_COLON && $i > 0 && isset($t[$i + 1])) {
|
||||||
|
$p = $t[$i - 1];
|
||||||
|
$nx = $t[$i + 1];
|
||||||
|
if (is_array($p) && $p[0] === T_STRING && is_array($nx) && $nx[0] === T_STRING) {
|
||||||
|
$j = nextSignificant($t, $i + 1);
|
||||||
|
$c = strtolower($p[1]);
|
||||||
|
if ($j !== null && $t[$j] === '(' && !in_array($c, array('parent', 'self', 'static'), true)) {
|
||||||
|
$calls[$c . '::' . strtolower($nx[1])] = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Kandidaten je Datei sammeln (Token-Index der function-Deklaration)
|
||||||
|
$todo = array();
|
||||||
|
foreach ($calls as $key => $_) {
|
||||||
|
if (!isset($methods[$key])) continue;
|
||||||
|
list($path, $idx, $static, $usesThis) = $methods[$key];
|
||||||
|
if ($static || $usesThis) continue;
|
||||||
|
// Nicht anfassen, wenn eine Unterklasse die Methode nicht-statisch ueberschreibt
|
||||||
|
list($target, $m) = explode('::', $key);
|
||||||
|
$overridden = false;
|
||||||
|
foreach ($methods as $other => $info) {
|
||||||
|
list($oc, $om) = explode('::', $other);
|
||||||
|
if ($om !== $m || $oc === $target || $info[2]) continue;
|
||||||
|
for ($a = $oc, $guard = 0; isset($parents[$a]) && $guard < 20; $a = $parents[$a], $guard++) {
|
||||||
|
if ($parents[$a] === $target) { $overridden = true; break 2; }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if ($overridden) continue;
|
||||||
|
$todo[$path][] = $idx;
|
||||||
|
}
|
||||||
|
|
||||||
|
$result = array();
|
||||||
|
foreach ($todo as $path => $indexes) {
|
||||||
|
$t = $tokensByFile[$path];
|
||||||
|
foreach ($indexes as $idx) {
|
||||||
|
$t[$idx] = array(T_FUNCTION, 'static ' . $t[$idx][1], 0);
|
||||||
|
}
|
||||||
|
$out = '';
|
||||||
|
foreach ($t as $tok) $out .= is_array($tok) ? $tok[1] : $tok;
|
||||||
|
file_put_contents($path, $out);
|
||||||
|
$result[$path] = count($indexes);
|
||||||
|
}
|
||||||
|
return $result;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Ersetzt String-Offsets mit geschweiften Klammern ($str{0}) durch eckige
|
||||||
|
* Klammern ($str[0]); unter PHP 8 ist die alte Syntax ein Parse-Error.
|
||||||
|
* Erfasst wird nur "{" direkt nach einer Variablen oder "]" (ohne
|
||||||
|
* Leerzeichen), dort hat "{" keine andere Bedeutung.
|
||||||
|
*
|
||||||
|
* Liefert [neuer Quelltext, Anzahl ersetzter Offsets].
|
||||||
|
*/
|
||||||
|
function patchCurlyOffsets($src)
|
||||||
|
{
|
||||||
|
if (strpos($src, '{') === false) return array($src, 0);
|
||||||
|
$tokens = @token_get_all($src);
|
||||||
|
$n = count($tokens);
|
||||||
|
$count = 0;
|
||||||
|
for ($i = 1; $i < $n; $i++) {
|
||||||
|
if ($tokens[$i] !== '{') continue;
|
||||||
|
$prev = $tokens[$i - 1];
|
||||||
|
if (!($prev === ']' || (is_array($prev) && $prev[0] === T_VARIABLE))) continue;
|
||||||
|
// Passende schliessende Klammer suchen
|
||||||
|
$depth = 0;
|
||||||
|
for ($j = $i; $j < $n; $j++) {
|
||||||
|
$t = $tokens[$j];
|
||||||
|
if ($t === '{' || (is_array($t) && in_array($t[0], array(T_CURLY_OPEN, T_DOLLAR_OPEN_CURLY_BRACES), true))) $depth++;
|
||||||
|
elseif ($t === '}') { $depth--; if ($depth === 0) break; }
|
||||||
|
}
|
||||||
|
if ($j >= $n) continue;
|
||||||
|
$tokens[$i] = '[';
|
||||||
|
$tokens[$j] = ']';
|
||||||
|
$count++;
|
||||||
|
}
|
||||||
|
if ($count === 0) return array($src, 0);
|
||||||
|
$out = '';
|
||||||
|
foreach ($tokens as $t) $out .= is_array($t) ? $t[1] : $t;
|
||||||
|
return array($out, $count);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Liefert [neuer Quelltext, Anzahl eingefuegter Konstruktoren].
|
||||||
|
*/
|
||||||
|
function patchConstructors($src)
|
||||||
|
{
|
||||||
|
if (stripos($src, 'class') === false) return array($src, 0);
|
||||||
|
$eol = (strpos($src, "\r\n") !== false) ? "\r\n" : "\n";
|
||||||
|
$tokens = @token_get_all($src);
|
||||||
|
$n = count($tokens);
|
||||||
|
$inserts = array(); // Byte-Offset => einzufuegender Text
|
||||||
|
|
||||||
|
// Byte-Offsets aller Tokens berechnen
|
||||||
|
$offsets = array();
|
||||||
|
$pos = 0;
|
||||||
|
for ($i = 0; $i < $n; $i++) {
|
||||||
|
$offsets[$i] = $pos;
|
||||||
|
$pos += strlen(is_array($tokens[$i]) ? $tokens[$i][1] : $tokens[$i]);
|
||||||
|
}
|
||||||
|
|
||||||
|
for ($i = 0; $i < $n; $i++) {
|
||||||
|
if (!is_array($tokens[$i]) || $tokens[$i][0] !== T_CLASS) continue;
|
||||||
|
|
||||||
|
// "Foo::class" und anonyme Klassen ("new class") ignorieren
|
||||||
|
$prev = prevSignificant($tokens, $i);
|
||||||
|
if ($prev !== null && is_array($tokens[$prev]) && in_array($tokens[$prev][0], array(T_DOUBLE_COLON, T_NEW), true)) continue;
|
||||||
|
|
||||||
|
$nameIdx = nextSignificant($tokens, $i);
|
||||||
|
if ($nameIdx === null || !is_array($tokens[$nameIdx]) || $tokens[$nameIdx][0] !== T_STRING) continue;
|
||||||
|
$className = $tokens[$nameIdx][1];
|
||||||
|
|
||||||
|
// Oeffnende Klammer des Klassenkoerpers suchen
|
||||||
|
$open = $nameIdx;
|
||||||
|
while ($open < $n && $tokens[$open] !== '{') $open++;
|
||||||
|
if ($open >= $n) continue;
|
||||||
|
|
||||||
|
// Methoden auf Klassenebene einsammeln
|
||||||
|
$depth = 0;
|
||||||
|
$hasConstruct = false;
|
||||||
|
$oldCtor = null;
|
||||||
|
for ($j = $open; $j < $n; $j++) {
|
||||||
|
$t = $tokens[$j];
|
||||||
|
if ($t === '{' || (is_array($t) && in_array($t[0], array(T_CURLY_OPEN, T_DOLLAR_OPEN_CURLY_BRACES), true))) {
|
||||||
|
$depth++;
|
||||||
|
} elseif ($t === '}') {
|
||||||
|
$depth--;
|
||||||
|
if ($depth === 0) break;
|
||||||
|
} elseif ($depth === 1 && is_array($t) && $t[0] === T_FUNCTION) {
|
||||||
|
$k = nextSignificant($tokens, $j);
|
||||||
|
if ($k !== null && $tokens[$k] === '&') $k = nextSignificant($tokens, $k);
|
||||||
|
if ($k === null || !is_array($tokens[$k])) continue;
|
||||||
|
$method = $tokens[$k][1];
|
||||||
|
if (strcasecmp($method, '__construct') === 0) $hasConstruct = true;
|
||||||
|
if (strcasecmp($method, $className) === 0) $oldCtor = $k;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if ($hasConstruct || $oldCtor === null) continue;
|
||||||
|
|
||||||
|
// Parameterliste der alten Methode uebernehmen
|
||||||
|
$p = $oldCtor;
|
||||||
|
while ($p < $n && $tokens[$p] !== '(') $p++;
|
||||||
|
$params = '';
|
||||||
|
$vars = array();
|
||||||
|
$byRef = false;
|
||||||
|
$pd = 0;
|
||||||
|
for ($q = $p; $q < $n; $q++) {
|
||||||
|
$t = $tokens[$q];
|
||||||
|
if ($t === '(') { $pd++; if ($pd === 1) continue; }
|
||||||
|
if ($t === ')') { $pd--; if ($pd === 0) break; }
|
||||||
|
$txt = is_array($t) ? $t[1] : $t;
|
||||||
|
$params .= $txt;
|
||||||
|
if ($pd === 1 && is_array($t) && $t[0] === T_VARIABLE) $vars[] = $t[1];
|
||||||
|
if ($pd === 1 && $t === '&') $byRef = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Ohne Referenzparameter func_get_args() nutzen (gleiche Semantik bei
|
||||||
|
// optionalen Parametern), sonst die Variablen direkt durchreichen.
|
||||||
|
$call = $byRef ? implode(', ', $vars) : '...func_get_args()';
|
||||||
|
$shim = "{$eol}\t// tmserver-docker: Php8Compat{$eol}"
|
||||||
|
. "\tfunction __construct(" . trim($params) . ") { \$this->{$tokens[$oldCtor][1]}($call); }";
|
||||||
|
$inserts[$offsets[$open] + 1] = $shim;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (empty($inserts)) return array($src, 0);
|
||||||
|
krsort($inserts);
|
||||||
|
foreach ($inserts as $off => $txt) {
|
||||||
|
$src = substr($src, 0, $off) . $txt . substr($src, $off);
|
||||||
|
}
|
||||||
|
return array($src, count($inserts));
|
||||||
|
}
|
||||||
|
|
||||||
|
function nextSignificant($tokens, $i)
|
||||||
|
{
|
||||||
|
for ($j = $i + 1, $n = count($tokens); $j < $n; $j++) {
|
||||||
|
if (is_array($tokens[$j]) && in_array($tokens[$j][0], array(T_WHITESPACE, T_COMMENT, T_DOC_COMMENT), true)) continue;
|
||||||
|
return $j;
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
function prevSignificant($tokens, $i)
|
||||||
|
{
|
||||||
|
for ($j = $i - 1; $j >= 0; $j--) {
|
||||||
|
if (is_array($tokens[$j]) && in_array($tokens[$j][0], array(T_WHITESPACE, T_COMMENT, T_DOC_COMMENT), true)) continue;
|
||||||
|
return $j;
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
@@ -244,6 +244,54 @@ else
|
|||||||
echo "==> Vorhandene AdminServ-Daten gefunden. Keine Aenderungen."
|
echo "==> Vorhandene AdminServ-Daten gefunden. Keine Aenderungen."
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# ============================================================
|
||||||
|
# RemoteCP: PHP-7.4-Kompatibilitaet & Fehleranzeige (bei jedem Start)
|
||||||
|
# ============================================================
|
||||||
|
# RemoteCP 4.0.3.5 nutzt veraltete Syntax ($str{0}, PHP4-Konstruktor), die
|
||||||
|
# unter PHP 7.4 Deprecation-Meldungen im Browser erzeugt (unter PHP 8 fatal).
|
||||||
|
# Ausserdem erzwingt core.functions.php display_errors=1 per ini_set() und
|
||||||
|
# ignoriert damit PHP_DISPLAY_ERRORS. Die Patches sind idempotent und greifen
|
||||||
|
# auch bei bestehenden Volumes.
|
||||||
|
RCP_INC="$ADMINSERV_DIR/remotecp/includes"
|
||||||
|
if [ -d "$RCP_INC" ]; then
|
||||||
|
echo "==> Patche RemoteCP fuer PHP 7.4..."
|
||||||
|
|
||||||
|
# Geschweifte Klammern fuer String-Offsets -> eckige Klammern
|
||||||
|
[ -f "$RCP_INC/core/rcp_textparser.class.php" ] && sed -i -E \
|
||||||
|
-e 's/\$hex\{([0-9])\}/$hex[\1]/g' \
|
||||||
|
-e 's/function TMFColorParser\(/function __construct(/' \
|
||||||
|
"$RCP_INC/core/rcp_textparser.class.php"
|
||||||
|
[ -f "$RCP_INC/core/GbxRemote.inc.php" ] && sed -i -E \
|
||||||
|
-e 's/\$f_v\{([0-9])\}/$f_v[\1]/g' \
|
||||||
|
"$RCP_INC/core/GbxRemote.inc.php"
|
||||||
|
|
||||||
|
# display_errors an PHP_DISPLAY_ERRORS koppeln
|
||||||
|
if [ -f "$RCP_INC/core.functions.php" ]; then
|
||||||
|
sed -i -E \
|
||||||
|
-e "s/^ini_set\('display_errors', 1\);/ini_set('display_errors', getenv('PHP_DISPLAY_ERRORS') === 'true' ? 1 : 0);/" \
|
||||||
|
-e "s/^ini_set\('display_startup_errors', 1\);/ini_set('display_startup_errors', getenv('PHP_DISPLAY_ERRORS') === 'true' ? 1 : 0);/" \
|
||||||
|
"$RCP_INC/core.functions.php"
|
||||||
|
# PHP-Warnings ohne Debug-Modus nur loggen, nicht im Browser anzeigen.
|
||||||
|
# v2: Unter PHP 8 sind viele fruehere Notices (Undefined array key, ...)
|
||||||
|
# Warnings; die werden wie unter PHP 7 ignoriert, sonst waechst das Log
|
||||||
|
# um mehrere MB pro Tag. Alte v1-Variante wird ersetzt.
|
||||||
|
if ! grep -q 'tmserver-docker: PHP_DISPLAY_ERRORS v2' "$RCP_INC/core.functions.php"; then
|
||||||
|
sed -i '/tmserver-docker: PHP_DISPLAY_ERRORS - /,/^\t}$/d' "$RCP_INC/core.functions.php"
|
||||||
|
sed -i "/if(error_reporting() == 0) return;/a\\
|
||||||
|
\\t//tmserver-docker: PHP_DISPLAY_ERRORS v2 - PHP-Warnings ohne Debug-Modus nur loggen\\
|
||||||
|
\\tif(\$errno == E_WARNING \&\& !ini_get('display_errors')) {\\
|
||||||
|
\\t\\tif(preg_match('/^(Undefined (array key|variable|property|offset)|Attempt to read property|Trying to access array offset|Constant .* already defined|Array to string conversion)/', \$errstr)) return true;\\
|
||||||
|
\\t\\twriteLog('errors', \"[PHP Warning] \$errstr on line \$errline in file \$errfile\");\\
|
||||||
|
\\t\\treturn true;\\
|
||||||
|
\\t}" "$RCP_INC/core.functions.php"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
# sed -i legt neue Dateien als root an -> Besitzer wiederherstellen
|
||||||
|
chown www-data:www-data "$RCP_INC/core.functions.php" \
|
||||||
|
"$RCP_INC/core/rcp_textparser.class.php" "$RCP_INC/core/GbxRemote.inc.php" 2>/dev/null
|
||||||
|
fi
|
||||||
|
|
||||||
# ============================================================
|
# ============================================================
|
||||||
# XAseco: First-Run-Logik
|
# XAseco: First-Run-Logik
|
||||||
# ============================================================
|
# ============================================================
|
||||||
@@ -365,6 +413,66 @@ if [ "$XASECO_ENABLED" = "true" ]; then
|
|||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# ============================================================
|
||||||
|
# PHP-8-Kompatibilitaet (bei jedem Start, auch fuer bestehende Volumes)
|
||||||
|
# ============================================================
|
||||||
|
# AdminServ, RemoteCP und XAseco stammen aus PHP-5-Zeiten. Php8Compat.php
|
||||||
|
# ergaenzt __construct() fuer PHP-4-Konstruktoren und stellt String-Offsets
|
||||||
|
# mit geschweiften Klammern ($str{0}) auf eckige Klammern um. Idempotent.
|
||||||
|
echo "==> Pruefe PHP-8-Kompatibilitaet..."
|
||||||
|
php /opt/tmserver/Php8Compat.php "$ADMINSERV_DIR" /opt/tmserver/xaseco | tail -n 1
|
||||||
|
|
||||||
|
# XAseco: mysql_*-Shim (modernizer.inc.php) erwartet false bei SQL-Fehlern.
|
||||||
|
# Seit PHP 8.1 wirft mysqli standardmaessig Exceptions -> abschalten.
|
||||||
|
XASECO_MODERNIZER="/opt/tmserver/xaseco/includes/modernizer.inc.php"
|
||||||
|
if [ -f "$XASECO_MODERNIZER" ] && ! grep -q 'mysqli_report' "$XASECO_MODERNIZER"; then
|
||||||
|
sed -i '0,/^<?php/s//<?php\nmysqli_report(MYSQLI_REPORT_OFF); \/\/ tmserver-docker: PHP 8.1+/' "$XASECO_MODERNIZER"
|
||||||
|
echo " modernizer.inc.php: mysqli_report(MYSQLI_REPORT_OFF) ergaenzt."
|
||||||
|
fi
|
||||||
|
|
||||||
|
# XAseco: Webaccess initialisiert Antworten als '' statt array(). Schreib- und
|
||||||
|
# Lesezugriffe wie $response['Code'] waren unter PHP 7 nur Warnings
|
||||||
|
# ("Illegal string offset"), unter PHP 8 beenden sie XAseco (TypeError).
|
||||||
|
XASECO_WEBACCESS="/opt/tmserver/xaseco/includes/web_access.inc.php"
|
||||||
|
if [ -f "$XASECO_WEBACCESS" ] && grep -q "\['Response'\] = '';" "$XASECO_WEBACCESS"; then
|
||||||
|
sed -i "s/\['Response'\] = '';/['Response'] = array();/" "$XASECO_WEBACCESS"
|
||||||
|
echo " web_access.inc.php: Response als array() initialisiert."
|
||||||
|
fi
|
||||||
|
|
||||||
|
# XAseco TeamSpeak3-Plugin: count() auf null ist unter PHP 8 ein TypeError
|
||||||
|
XASECO_TS3="/opt/tmserver/xaseco/plugins/plugin.teamspeak3.php"
|
||||||
|
if [ -f "$XASECO_TS3" ] && grep -qF "if ( count(\$info['players']) > 0 ) {" "$XASECO_TS3"; then
|
||||||
|
sed -i "s/if ( count(\$info\['players'\]) > 0 ) {/if ( !empty(\$info['players']) \&\& is_array(\$info['players']) ) {/" "$XASECO_TS3"
|
||||||
|
echo " plugin.teamspeak3.php: count()-Pruefung entschaerft."
|
||||||
|
fi
|
||||||
|
|
||||||
|
# XAseco TeamSpeak3-Plugin: Antwortet der TS3-Query-Port nicht korrekt, wirft
|
||||||
|
# tsstatus.php eine Exception, die niemand faengt -> XAseco stirbt (auch unter
|
||||||
|
# PHP 7). Wie bei den uebrigen, bereits auskommentierten throws: leer zurueck.
|
||||||
|
XASECO_TSSTATUS="/opt/tmserver/xaseco/includes/tsstatus.php"
|
||||||
|
if [ -f "$XASECO_TSSTATUS" ] && grep -qF 'if(!$isTs3) throw new Exception("Not a Teamspeak 3 server/bad query port");' "$XASECO_TSSTATUS"; then
|
||||||
|
sed -i 's|if(!\$isTs3) throw new Exception("Not a Teamspeak 3 server/bad query port");|if(!$isTs3) { $this->disconnect(); return ""; } // tmserver-docker: kein Absturz|' "$XASECO_TSSTATUS"
|
||||||
|
echo " tsstatus.php: Exception bei fehlerhaftem TS3-Query entschaerft."
|
||||||
|
fi
|
||||||
|
|
||||||
|
# AdminServ: stat() liefert bei Dateinamen mit Sonderzeichen false (AdminServ
|
||||||
|
# wandelt sie vorher per utf8_encode um). @array_slice(false) war unter PHP 7
|
||||||
|
# still, unter PHP 8 ein TypeError -> "MatchSettings erstellen" brach ab.
|
||||||
|
ADMINSERV_FOLDER="$ADMINSERV_DIR/resources/class/folder.class.php"
|
||||||
|
if [ -f "$ADMINSERV_FOLDER" ] && grep -qF '@array_slice(@stat($pathToEntry), 20, 3)' "$ADMINSERV_FOLDER"; then
|
||||||
|
sed -i 's/@array_slice(@stat(\$pathToEntry), 20, 3)/((\$st = @stat(\$pathToEntry)) ? array_slice(\$st, 20, 3) : array())/' "$ADMINSERV_FOLDER"
|
||||||
|
echo " folder.class.php: stat()-Fehler abgefangen."
|
||||||
|
fi
|
||||||
|
|
||||||
|
# AdminServ: Felder wie LapsTimeLimit werden in ms angezeigt, beim Speichern
|
||||||
|
# aber nochmals mit 1000 multipliziert. Beim Maximalwert 2147483647 lehnt der
|
||||||
|
# Server den Aufruf ab (Numerical result out of range) -> auf int32 begrenzen.
|
||||||
|
ADMINSERV_TIMEDATE="$ADMINSERV_DIR/resources/class/timedate.class.php"
|
||||||
|
if [ -f "$ADMINSERV_TIMEDATE" ] && grep -qF 'if($millisec > 0){ return $millisec; }' "$ADMINSERV_TIMEDATE"; then
|
||||||
|
sed -i 's/if(\$millisec > 0){ return \$millisec; }/if($millisec > 0){ return min($millisec, 2147483647); }/' "$ADMINSERV_TIMEDATE"
|
||||||
|
echo " timedate.class.php: secToMillisec() auf int32 begrenzt."
|
||||||
|
fi
|
||||||
|
|
||||||
# ============================================================
|
# ============================================================
|
||||||
# XAseco: TeamSpeak3-Plugin Gateway aktualisieren (fuer bestehende Volumes)
|
# XAseco: TeamSpeak3-Plugin Gateway aktualisieren (fuer bestehende Volumes)
|
||||||
# ============================================================
|
# ============================================================
|
||||||
|
|||||||
@@ -94,8 +94,12 @@ check_xaseco_log() {
|
|||||||
if [ ! -f "$LOG_FILE" ]; then
|
if [ ! -f "$LOG_FILE" ]; then
|
||||||
return 0
|
return 0
|
||||||
fi
|
fi
|
||||||
# Letzte 20 Zeilen auf fatale Fehler / Verbindungsabbrueche pruefen
|
# Letzte 20 Zeilen auf fatale Fehler / Verbindungsabbrueche pruefen.
|
||||||
LAST_LINES=$(tail -20 "$LOG_FILE" 2>/dev/null)
|
# Fehlschlaege externer Webdienste (Dedimania, ManiaKarma, ...) laufen ueber
|
||||||
|
# Webaccess/fsockopen und betreffen nicht die Verbindung zum TM-Server.
|
||||||
|
# Ohne Filter loeste das nicht erreichbare dedimania.net alle ~30 Minuten
|
||||||
|
# einen XAseco-Neustart aus.
|
||||||
|
LAST_LINES=$(tail -20 "$LOG_FILE" 2>/dev/null | grep -v -i "webaccess\|fsockopen\|dedimania")
|
||||||
# Typische Fehlermeldungen bei XAseco-Verbindungsverlust
|
# Typische Fehlermeldungen bei XAseco-Verbindungsverlust
|
||||||
if echo "$LAST_LINES" | grep -qi "connection refused\|broken pipe\|server not responding\|transport error\|socket error\|fatal error"; then
|
if echo "$LAST_LINES" | grep -qi "connection refused\|broken pipe\|server not responding\|transport error\|socket error\|fatal error"; then
|
||||||
return 1
|
return 1
|
||||||
|
|||||||
@@ -42,6 +42,19 @@
|
|||||||
copytruncate
|
copytruncate
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# RemoteCP-Logs (liegen im persistenten Volume)
|
||||||
|
/var/www/html/remotecp/cache/*.log
|
||||||
|
{
|
||||||
|
su www-data www-data
|
||||||
|
size 10M
|
||||||
|
rotate 5
|
||||||
|
missingok
|
||||||
|
notifempty
|
||||||
|
compress
|
||||||
|
delaycompress
|
||||||
|
copytruncate
|
||||||
|
}
|
||||||
|
|
||||||
# AdminServ-Logs (liegen im persistenten Volume)
|
# AdminServ-Logs (liegen im persistenten Volume)
|
||||||
/var/www/html/logs/*.log
|
/var/www/html/logs/*.log
|
||||||
{
|
{
|
||||||
|
|||||||
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
services:
|
services:
|
||||||
tmserver:
|
tmserver:
|
||||||
image: git.techniverse.net/scriptos/trackmania-server:1.3.3
|
image: git.techniverse.net/scriptos/trackmania-server:1.4.0
|
||||||
build:
|
build:
|
||||||
context: .
|
context: .
|
||||||
container_name: tmserver
|
container_name: tmserver
|
||||||
|
|||||||
+1
-1
@@ -165,6 +165,6 @@ Falls RemoteCP nicht erreichbar ist oder Fehler anzeigt:
|
|||||||
|
|
||||||
### Bekannte Hinweise
|
### Bekannte Hinweise
|
||||||
|
|
||||||
- RemoteCP ist ein älteres Tool (Version 4.0.3.5) und wurde für PHP 5.x entwickelt, läuft aber mit PHP 7.4
|
- RemoteCP ist ein älteres Tool (Version 4.0.3.5) und wurde für PHP 5.x entwickelt. Ab v1.4.0 läuft es dank automatischer Kompatibilitäts-Patches beim Containerstart unter PHP 8.4 (siehe README)
|
||||||
- Die Live-Funktionen (`remoteCP[Live]`) benötigen eine laufende Serververbindung
|
- Die Live-Funktionen (`remoteCP[Live]`) benötigen eine laufende Serververbindung
|
||||||
- **Sicherheitshinweis:** Die Registrierung neuer Benutzer ist standardmäßig aktiviert. Aus Sicherheitsgründen sollte diese deaktiviert werden, damit sich keine unbefugten Nutzer einen Zugang anlegen können. Dazu in der Datei `data/controlpanel/remotecp/xml/settings/settings.xml` den Wert `<register>false</register>` setzen
|
- **Sicherheitshinweis:** Die Registrierung neuer Benutzer ist standardmäßig aktiviert. Aus Sicherheitsgründen sollte diese deaktiviert werden, damit sich keine unbefugten Nutzer einen Zugang anlegen können. Dazu in der Datei `data/controlpanel/remotecp/xml/settings/settings.xml` den Wert `<register>false</register>` setzen
|
||||||
+1
-1
@@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
XAseco ist ein Server-Controller für TrackMania Nations Forever. Er verwaltet lokale Rekorde, Dedimania-Weltrekorde, Karma/Votes, eine Track-Jukebox und vieles mehr direkt im Spielchat.
|
XAseco ist ein Server-Controller für TrackMania Nations Forever. Er verwaltet lokale Rekorde, Dedimania-Weltrekorde, Karma/Votes, eine Track-Jukebox und vieles mehr direkt im Spielchat.
|
||||||
|
|
||||||
Im Container wird die modifizierte Version **XAseco 1.16** verwendet, die für PHP 7.x angepasst wurde (Patches von Bueddel, Xymph, undef.de und reaby).
|
Im Container wird die modifizierte Version **XAseco 1.16** verwendet, die für PHP 7.x angepasst wurde (Patches von Bueddel, Xymph, undef.de und reaby). Ab v1.4.0 wird sie beim Containerstart zusätzlich automatisch für PHP 8.4 gepatcht (siehe README).
|
||||||
|
|
||||||
## Funktionsweise
|
## Funktionsweise
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user