Version tatsaechlich aus den Vorgabewerten lesen (Nachtrag zu 86bc5d9)

Der vorige Commit hat nur den Kommentar geaendert, der Ersetzungsausdruck griff
nicht. Jetzt lesen alle drei Skripte defaults, config und config-internal in
dieser Reihenfolge; der spaetere Wert gewinnt.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
gordon.zimm 2026-09-24 16:21:55 +02:00
parent 86bc5d9204
commit f1701675ef
3 changed files with 4 additions and 4 deletions

View File

@ -79,7 +79,7 @@ echo "--- Instanz"
echo "FQDN: $FQDN (Ring $RING)"
# Die Version steht je nach Stand in config.php oder in config-internal.php - EspoCRM selbst
# fragen ist verlaesslicher als eine der beiden Dateien zu raten.
VERSION="$(docker exec espocrm php -r 'foreach (["/var/www/html/data/config-internal.php","/var/www/html/data/config.php"] as $f) { $a = @include $f; if (is_array($a) && !empty($a["version"])) { echo $a["version"]; exit; } }' 2>/dev/null)"
VERSION="$(docker exec espocrm php -r '$v=""; foreach (["/var/www/html/application/Espo/Resources/defaults/config.php","/var/www/html/data/config.php","/var/www/html/data/config-internal.php"] as $f) { $a=@include $f; if (is_array($a) && !empty($a["version"])) { $v=$a["version"]; } } echo $v;' 2>/dev/null)"
[ -n "$VERSION" ] || VERSION="$(grep -hoP "['\"]version['\"]\s*=>\s*['\"]\K[^'\"]+" /srv/espo/data/config.php /srv/espo/data/config-internal.php 2>/dev/null | head -1)"
echo "Version: ${VERSION:-unbekannt}"
IMAGE="$(docker inspect -f '{{.Config.Image}}' espocrm 2>/dev/null)"

View File

@ -36,7 +36,7 @@ fi
# 3. Ausgangsstand festhalten, damit der Bericht ein Vorher und ein Nachher hat.
VORHER_IMAGE="$(docker inspect -f '{{.Config.Image}}' espocrm 2>/dev/null)"
VORHER_VERSION="$(docker exec espocrm php -r 'foreach (["/var/www/html/data/config-internal.php","/var/www/html/data/config.php"] as $f) { $a = @include $f; if (is_array($a) && !empty($a["version"])) { echo $a["version"]; exit; } }' 2>/dev/null)"
VORHER_VERSION="$(docker exec espocrm php -r '$v=""; foreach (["/var/www/html/application/Espo/Resources/defaults/config.php","/var/www/html/data/config.php","/var/www/html/data/config-internal.php"] as $f) { $a=@include $f; if (is_array($a) && !empty($a["version"])) { $v=$a["version"]; } } echo $v;' 2>/dev/null)"
echo "Vorher: Image ${VORHER_IMAGE:-unbekannt}, Version ${VORHER_VERSION:-unbekannt}"
# 4. Erst der Rueckweg, dann das Update. Ohne Snapshot wird nichts angefasst.
@ -81,7 +81,7 @@ echo "--- Container"
docker compose -f /srv/espo/docker-compose.yml ps --format 'table {{.Name}}\t{{.Status}}'
echo "--- Instanz"
NACHHER_IMAGE="$(docker inspect -f '{{.Config.Image}}' espocrm 2>/dev/null)"
NACHHER_VERSION="$(docker exec espocrm php -r 'foreach (["/var/www/html/data/config-internal.php","/var/www/html/data/config.php"] as $f) { $a = @include $f; if (is_array($a) && !empty($a["version"])) { echo $a["version"]; exit; } }' 2>/dev/null)"
NACHHER_VERSION="$(docker exec espocrm php -r '$v=""; foreach (["/var/www/html/application/Espo/Resources/defaults/config.php","/var/www/html/data/config.php","/var/www/html/data/config-internal.php"] as $f) { $a=@include $f; if (is_array($a) && !empty($a["version"])) { $v=$a["version"]; } } echo $v;' 2>/dev/null)"
echo "Image: ${VORHER_IMAGE:-unbekannt} -> ${NACHHER_IMAGE:-unbekannt}"
echo "Version: ${VORHER_VERSION:-unbekannt} -> ${NACHHER_VERSION:-unbekannt}"
echo "Digest: $(docker image inspect --format '{{if .RepoDigests}}{{index .RepoDigests 0}}{{else}}{{.Id}}{{end}}' "$NACHHER_IMAGE" 2>/dev/null)"

View File

@ -29,7 +29,7 @@ ESPO_IMAGE="$(docker inspect -f '{{.Config.Image}}' espocrm 2>/dev/null)"
[ -n "$ESPO_IMAGE" ] || fehler "Container 'espocrm' nicht gefunden - laeuft die Instanz?"
ESPO_DIGEST="$(docker image inspect --format '{{if .RepoDigests}}{{index .RepoDigests 0}}{{else}}{{.Id}}{{end}}' "$ESPO_IMAGE" 2>/dev/null)"
[ -n "$ESPO_DIGEST" ] || fehler "Digest des EspoCRM-Images nicht ermittelbar"
ESPO_VERSION="$(docker exec espocrm php -r 'foreach (["/var/www/html/data/config-internal.php","/var/www/html/data/config.php"] as $f) { $a = @include $f; if (is_array($a) && !empty($a["version"])) { echo $a["version"]; exit; } }' 2>/dev/null)"
ESPO_VERSION="$(docker exec espocrm php -r '$v=""; foreach (["/var/www/html/application/Espo/Resources/defaults/config.php","/var/www/html/data/config.php","/var/www/html/data/config-internal.php"] as $f) { $a=@include $f; if (is_array($a) && !empty($a["version"])) { $v=$a["version"]; } } echo $v;' 2>/dev/null)"
[ -n "$ESPO_VERSION" ] || ESPO_VERSION="$(grep -hoP "['\"]version['\"]\s*=>\s*['\"]\K[^'\"]+" /srv/espo/data/config-internal.php /srv/espo/data/config.php 2>/dev/null | head -1)"
if [ -z "$ESPO_VERSION" ]; then
echo "--- Diagnose: vorhandene Konfigurationsdateien"