From 07689a4831464fea75b87121d1dcf73683a0a024 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tobias=20Kn=C3=B6ppler?= <6317548+theCalcaholic@users.noreply.github.com> Date: Sat, 21 Jan 2023 16:02:48 +0100 Subject: [PATCH] Revert "library.sh: Simplify clear_opcache" MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This reverts commit 59c2297c808a44344a22966369f4b26166779d4d. Signed-off-by: Tobias Knöppler <6317548+theCalcaholic@users.noreply.github.com> --- bin/ncp-restore | 7 +------ etc/library.sh | 8 ++++++++ 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/bin/ncp-restore b/bin/ncp-restore index 41987b70..228afc6d 100755 --- a/bin/ncp-restore +++ b/bin/ncp-restore @@ -38,10 +38,7 @@ free=$( df "$TMPDIR" | tail -1 | awk '{ print $4 }' ) # EXTRACT FILES echo "extracting backup file $BACKUPFILE..." -tar $compress_arg -xf "$BACKUPFILE" -C "$TMPDIR" || { - echo "An error occurred. Abort" - exit 1 -} +tar $compress_arg -xf "$BACKUPFILE" -C "$TMPDIR" || exit 1 ## SANITY CHECKS [[ -d "$TMPDIR"/nextcloud ]] && [[ -f "$( ls "$TMPDIR"/nextcloud-sqlbkp_*.bak 2>/dev/null )" ]] || { @@ -189,5 +186,3 @@ ncc files:scan-app-data clear_opcache bash -c "sleep 3; service php${PHPVER}-fpm restart" &>/dev/null & } - -} diff --git a/etc/library.sh b/etc/library.sh index 8e4de6bd..cc330404 100644 --- a/etc/library.sh +++ b/etc/library.sh @@ -596,6 +596,14 @@ function get_nc_config_value() { } function clear_opcache() { + # shellcheck disable=SC2155 + local data_dir="$(get_nc_config_value datadirectory)" + ! [[ -d "${data_dir:-/var/www/data}/.opcache" ]] || { + echo "Clearing opcache..." + echo "This can take some time. Please don't interrupt the process/close your browser tab." + rm -rf "${data_dir:-/var/www/data}/.opcache"/* + echo "Done." + } service php${PHPVER}-fpm reload }