Revert "library.sh: Simplify clear_opcache"

This reverts commit 59c2297c808a44344a22966369f4b26166779d4d.

Signed-off-by: Tobias Knöppler <6317548+theCalcaholic@users.noreply.github.com>
This commit is contained in:
Tobias Knöppler 2023-01-21 16:02:48 +01:00
parent cfc4d57306
commit 07689a4831
No known key found for this signature in database
GPG Key ID: 3510056072886A8F
2 changed files with 9 additions and 6 deletions

View File

@ -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 &
}
}

View File

@ -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
}