Skip to content

Commit 07689a4

Browse files
committed
Revert "library.sh: Simplify clear_opcache"
This reverts commit 59c2297. Signed-off-by: Tobias Knöppler <6317548+theCalcaholic@users.noreply.github.com>
1 parent cfc4d57 commit 07689a4

2 files changed

Lines changed: 9 additions & 6 deletions

File tree

bin/ncp-restore

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -38,10 +38,7 @@ free=$( df "$TMPDIR" | tail -1 | awk '{ print $4 }' )
3838

3939
# EXTRACT FILES
4040
echo "extracting backup file $BACKUPFILE..."
41-
tar $compress_arg -xf "$BACKUPFILE" -C "$TMPDIR" || {
42-
echo "An error occurred. Abort"
43-
exit 1
44-
}
41+
tar $compress_arg -xf "$BACKUPFILE" -C "$TMPDIR" || exit 1
4542

4643
## SANITY CHECKS
4744
[[ -d "$TMPDIR"/nextcloud ]] && [[ -f "$( ls "$TMPDIR"/nextcloud-sqlbkp_*.bak 2>/dev/null )" ]] || {
@@ -189,5 +186,3 @@ ncc files:scan-app-data
189186
clear_opcache
190187
bash -c "sleep 3; service php${PHPVER}-fpm restart" &>/dev/null &
191188
}
192-
193-
}

etc/library.sh

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -596,6 +596,14 @@ function get_nc_config_value() {
596596
}
597597

598598
function clear_opcache() {
599+
# shellcheck disable=SC2155
600+
local data_dir="$(get_nc_config_value datadirectory)"
601+
! [[ -d "${data_dir:-/var/www/data}/.opcache" ]] || {
602+
echo "Clearing opcache..."
603+
echo "This can take some time. Please don't interrupt the process/close your browser tab."
604+
rm -rf "${data_dir:-/var/www/data}/.opcache"/*
605+
echo "Done."
606+
}
599607
service php${PHPVER}-fpm reload
600608
}
601609

0 commit comments

Comments
 (0)