diff --git a/conf/nginx-top.conf b/conf/nginx-top.conf index c3f4c0d69..6e01e3d52 100644 --- a/conf/nginx-top.conf +++ b/conf/nginx-top.conf @@ -7,6 +7,6 @@ ## your own --- please do not ask for help from us. upstream php-fpm { - server unix:/var/run/php/php8.0-fpm.sock; + server unix:/var/run/php/php8.1-fpm.sock; } diff --git a/management/backup.py b/management/backup.py index aae6c00b8..34091601b 100755 --- a/management/backup.py +++ b/management/backup.py @@ -296,7 +296,7 @@ def service_command(service, command, quit=None): if quit: sys.exit(code) - service_command("php8.0-fpm", "stop", quit=True) + service_command("php8.1-fpm", "stop", quit=True) service_command("postfix", "stop", quit=True) service_command("dovecot", "stop", quit=True) service_command("postgrey", "stop", quit=True) @@ -333,7 +333,7 @@ def service_command(service, command, quit=None): service_command("postgrey", "start", quit=False) service_command("dovecot", "start", quit=False) service_command("postfix", "start", quit=False) - service_command("php8.0-fpm", "start", quit=False) + service_command("php8.1-fpm", "start", quit=False) # Remove old backups. This deletes all backup data no longer needed # from more than 3 days ago. diff --git a/setup/functions.sh b/setup/functions.sh index 6a96cc1f8..85925e6c3 100644 --- a/setup/functions.sh +++ b/setup/functions.sh @@ -5,7 +5,7 @@ # -o pipefail: don't ignore errors in the non-last command in a pipeline set -euo pipefail -PHP_VER=8.0 +PHP_VER=8.1 function hide_output { # This function hides the output of a command unless the command fails diff --git a/setup/nextcloud.sh b/setup/nextcloud.sh index 496ca0c02..104983c0c 100755 --- a/setup/nextcloud.sh +++ b/setup/nextcloud.sh @@ -90,6 +90,24 @@ InstallNextcloud() { echo "Upgrading to Nextcloud version $version" 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 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 # ownCloud 8.1.1 broke upgrades. It may fail on the first attempt, but # 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=$? if [ $E -ne 0 ] && [ $E -ne 3 ]; then 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=$? 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." fi # 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"$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-indices + 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. - 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 } diff --git a/tools/owncloud-restore.sh b/tools/owncloud-restore.sh index 05d576415..6b3f3e92f 100755 --- a/tools/owncloud-restore.sh +++ b/tools/owncloud-restore.sh @@ -26,7 +26,7 @@ if [ ! -f "$1/config.php" ]; then fi echo "Restoring backup from $1" -service php8.0-fpm stop +service php8.1-fpm stop # remove the current ownCloud/Nextcloud installation rm -rf /usr/local/lib/owncloud/ @@ -45,5 +45,5 @@ chown www-data:www-data "$STORAGE_ROOT/owncloud/config.php" sudo -u www-data "php$PHP_VER" /usr/local/lib/owncloud/occ maintenance:mode --off -service php8.0-fpm start +service php8.1-fpm start echo "Done"