1
0
mirror of https://github.com/mail-in-a-box/mailinabox.git synced 2024-11-23 02:27:05 +00:00

Update nextcloud.sh PHP8.1 add nc_php_ver

This commit is contained in:
matidau 2024-08-02 16:55:21 +10:00
parent 5b3d8fe4db
commit 58db57d24c

View File

@ -90,6 +90,24 @@ InstallNextcloud() {
echo "Upgrading to Nextcloud version $version" echo "Upgrading to Nextcloud version $version"
echo echo
# set PHP version, set to earlier version if required for upgrade
nc_php_ver="$PHP_VER"
if [[ ${version} =~ ^2[0123] ]]; then
nc_php_ver=8.0
fi
# install earlier PHP version
if [ "$nc_php_ver" != "$PHP_VER" ]; then
apt_install curl php"${nc_php_ver}" php"${nc_php_ver}"-fpm \
php"${nc_php_ver}"-cli php"${nc_php_ver}"-sqlite3 php"${nc_php_ver}"-gd php"${nc_php_ver}"-imap php"${nc_php_ver}"-curl \
php"${nc_php_ver}"-dev php"${nc_php_ver}"-gd php"${nc_php_ver}"-xml php"${nc_php_ver}"-mbstring php"${nc_php_ver}"-zip php"${nc_php_ver}"-apcu \
php"${nc_php_ver}"-intl php"${nc_php_ver}"-imagick php"${nc_php_ver}"-gmp php"${nc_php_ver}"-bcmath
tools/editconf.py /etc/php/"$nc_php_ver"/mods-available/apcu.ini -c ';' \
apc.enabled=1 \
apc.enable_cli=1
fi
# Download and verify # Download and verify
wget_verify "https://download.nextcloud.com/server/releases/nextcloud-$version.zip" "$hash" /tmp/nextcloud.zip wget_verify "https://download.nextcloud.com/server/releases/nextcloud-$version.zip" "$hash" /tmp/nextcloud.zip
@ -138,23 +156,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
} }