@@ -81,6 +81,14 @@ file_env() {
8181 unset " $fileVar "
8282}
8383
84+ get_enabled_apps () {
85+ run_as ' php /var/www/html/occ app:list' \
86+ | sed -n ' /^Enabled:$/,/^Disabled:$/p' \
87+ | sed ' 1d;$d' \
88+ | sed -n ' s/^ - \([^:]*\):.*/\1/p' \
89+ | sort
90+ }
91+
8492# Write PHP session config for Redis to /usr/local/etc/php/conf.d/redis-session.ini
8593configure_redis_session () {
8694 echo " => Configuring PHP session handler..."
@@ -188,7 +196,7 @@ if expr "$1" : "apache" 1>/dev/null || [ "$1" = "php-fpm" ] || [ "${NEXTCLOUD_UP
188196 exit 1
189197 fi
190198 echo " Upgrading nextcloud from $installed_version ..."
191- run_as ' php /var/www/html/occ app:list ' | sed -n " /Enabled:/,/Disabled:/p " > /tmp/list_before
199+ get_enabled_apps > /tmp/list_before
192200 fi
193201 if [ " $( id -u) " = 0 ]; then
194202 rsync_options=" -rlDog --chown $user :$group "
@@ -286,9 +294,12 @@ if expr "$1" : "apache" 1>/dev/null || [ "$1" = "php-fpm" ] || [ "${NEXTCLOUD_UP
286294
287295 run_as ' php /var/www/html/occ upgrade'
288296
289- run_as ' php /var/www/html/occ app:list' | sed -n " /Enabled:/,/Disabled:/p" > /tmp/list_after
290- echo " The following apps have been disabled:"
291- diff /tmp/list_before /tmp/list_after | grep ' <' | cut -d- -f2 | cut -d: -f1
297+ get_enabled_apps > /tmp/list_after
298+ disabled_apps=" $( comm -23 /tmp/list_before /tmp/list_after || true) "
299+ if [ -n " $disabled_apps " ]; then
300+ echo " The following apps have been disabled:"
301+ printf ' %s\n' " $disabled_apps "
302+ fi
292303 rm -f /tmp/list_before /tmp/list_after
293304
294305 run_path post-upgrade
0 commit comments