1
0
mirror of https://github.com/mail-in-a-box/mailinabox.git synced 2025-02-26 18:17:09 +00:00

Use local variable to indicat PHP version to be used

This commit is contained in:
KiekerJan 2025-02-15 15:09:59 +01:00
parent cac493fcf3
commit 87deed6459

View File

@ -62,6 +62,9 @@ user_external_hash=280d24eb2a6cb56b4590af8847f925c28d8d853e
# 5.3 You still can create, edit and delete users # 5.3 You still can create, edit and delete users
# 5.4 Go to Administration > Logs and ensure no new errors are shown # 5.4 Go to Administration > Logs and ensure no new errors are shown
# Set a local variable for the PHP version
NC_PHP_VER=PHP_VER
# Clear prior packages and install dependencies from apt. # Clear prior packages and install dependencies from apt.
apt-get purge -qq -y owncloud* # we used to use the package manager apt-get purge -qq -y owncloud* # we used to use the package manager
@ -138,23 +141,23 @@ InstallNextcloud() {
if [ -e "$STORAGE_ROOT/owncloud/owncloud.db" ]; then if [ -e "$STORAGE_ROOT/owncloud/owncloud.db" ]; then
# ownCloud 8.1.1 broke upgrades. It may fail on the first attempt, but # ownCloud 8.1.1 broke upgrades. It may fail on the first attempt, but
# that can be OK. # that can be OK.
sudo -u www-data php"$PHP_VER" /usr/local/lib/owncloud/occ upgrade sudo -u www-data php"$NC_PHP_VER" /usr/local/lib/owncloud/occ upgrade
E=$? E=$?
if [ $E -ne 0 ] && [ $E -ne 3 ]; then if [ $E -ne 0 ] && [ $E -ne 3 ]; then
echo "Trying ownCloud upgrade again to work around ownCloud upgrade bug..." echo "Trying ownCloud upgrade again to work around ownCloud upgrade bug..."
sudo -u www-data php"$PHP_VER" /usr/local/lib/owncloud/occ upgrade sudo -u www-data php"$NC_PHP_VER" /usr/local/lib/owncloud/occ upgrade
E=$? E=$?
if [ $E -ne 0 ] && [ $E -ne 3 ]; then exit 1; fi if [ $E -ne 0 ] && [ $E -ne 3 ]; then exit 1; fi
sudo -u www-data php"$PHP_VER" /usr/local/lib/owncloud/occ maintenance:mode --off sudo -u www-data php"$NC_PHP_VER" /usr/local/lib/owncloud/occ maintenance:mode --off
echo "...which seemed to work." echo "...which seemed to work."
fi fi
# Add missing indices. NextCloud didn't include this in the normal upgrade because it might take some time. # Add missing indices. NextCloud didn't include this in the normal upgrade because it might take some time.
sudo -u www-data php"$PHP_VER" /usr/local/lib/owncloud/occ db:add-missing-indices sudo -u www-data php"$NC_PHP_VER" /usr/local/lib/owncloud/occ db:add-missing-indices
sudo -u www-data php"$PHP_VER" /usr/local/lib/owncloud/occ db:add-missing-primary-keys sudo -u www-data php"$NC_PHP_VER" /usr/local/lib/owncloud/occ db:add-missing-primary-keys
# Run conversion to BigInt identifiers, this process may take some time on large tables. # Run conversion to BigInt identifiers, this process may take some time on large tables.
sudo -u www-data php"$PHP_VER" /usr/local/lib/owncloud/occ db:convert-filecache-bigint --no-interaction sudo -u www-data php"$NC_PHP_VER" /usr/local/lib/owncloud/occ db:convert-filecache-bigint --no-interaction
fi fi
} }
@ -228,10 +231,10 @@ if [ ! -d /usr/local/lib/owncloud/ ] || [[ ! ${CURRENT_NEXTCLOUD_VER} =~ ^$nextc
php8.0-curl php8.0-dev php8.0-xml php8.0-mbstring php8.0-zip php8.0-curl php8.0-dev php8.0-xml php8.0-mbstring php8.0-zip
# set php version 8.0 as default # set php version 8.0 as default
PHP_VER=8.0 NC_PHP_VER=8.0
# Make sure apc is enabled # Make sure apc is enabled
tools/editconf.py /etc/php/$PHP_VER/mods-available/apcu.ini -c ';' \ tools/editconf.py /etc/php/$NC_PHP_VER/mods-available/apcu.ini -c ';' \
apc.enabled=1 \ apc.enabled=1 \
apc.enable_cli=1 apc.enable_cli=1
fi fi
@ -257,7 +260,7 @@ if [ ! -d /usr/local/lib/owncloud/ ] || [[ ! ${CURRENT_NEXTCLOUD_VER} =~ ^$nextc
# From nextcloud 24 and higher, php8.1 is supported, so we can now remove the php8.0 ppa and packages # From nextcloud 24 and higher, php8.1 is supported, so we can now remove the php8.0 ppa and packages
# Reset the default php version used # Reset the default php version used
PHP_VER=8.1 NC_PHP_VER=8.1
# Remove older php version # Remove older php version
apt-get purge -qq -y php8.0 php8.0-fpm php8.0-apcu php8.0-cli php8.0-sqlite3 php8.0-gd \ apt-get purge -qq -y php8.0 php8.0-fpm php8.0-apcu php8.0-cli php8.0-sqlite3 php8.0-gd \