From 316ea5a61870e077bfa94b9fd7fa6e3433347efe Mon Sep 17 00:00:00 2001 From: szaimen Date: Tue, 26 Apr 2022 19:17:38 +0200 Subject: [PATCH] Block Nextcloud from starting if php version is not compatible with installed NC version Signed-off-by: szaimen --- Containers/nextcloud/entrypoint.sh | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/Containers/nextcloud/entrypoint.sh b/Containers/nextcloud/entrypoint.sh index ab7dd083..d902c9db 100644 --- a/Containers/nextcloud/entrypoint.sh +++ b/Containers/nextcloud/entrypoint.sh @@ -48,6 +48,14 @@ if [ "$installed_version" != "0.0.0.0" ]; then unset ADMIN_PASSWORD fi +# Don't start the container if Nextcloud is not compatible with the PHP version +if [ -f "/var/www/html/lib/versioncheck.php" ] && ! php /var/www/html/lib/versioncheck.php; then + echo "It seems like your installed Nextcloud is not compatible with the by the container provided PHP version." + echo "This most likely happened because you tried to restore an old Nextcloud version from backup that is not compatible with the PHP version that comes with the container." + echo "Please try to restore a more recent backup which contains a Nextcloud version that is compatible with the PHP version that comes with the container." + exit 1 +fi + # Skip any update if Nextcloud was just restored if ! [ -f "/mnt/ncdata/skip.update" ]; then if version_greater "$image_version" "$installed_version"; then