Fix broken conditional check that identifies whether content is cached in order to clean it.

This commit is contained in:
Nolan Darilek 2017-03-14 14:58:51 -05:00
parent 26eaf5114b
commit 3d2cf298bf
1 changed files with 5 additions and 6 deletions

View File

@ -53,20 +53,19 @@ function cleanup()
{ {
local data_path="$1" # full path to data directory of wiki local data_path="$1" # full path to data directory of wiki
local retention_days="$2" # number of days after which old files are to be removed local retention_days="$2" # number of days after which old files are to be removed
# purge files older than ${retention_days} days from attic and media_attic (old revisions) # purge files older than ${retention_days} days from attic and media_attic (old revisions)
find "${data_path}"/{media_,}attic/ -type f -mtime +${retention_days} -delete find "${data_path}"/{media_,}attic/ -type f -mtime +${retention_days} -delete
# remove stale lock files (files which are 1-2 days old) # remove stale lock files (files which are 1-2 days old)
find "${data_path}"/locks/ -name '*.lock' -type f -mtime +1 -delete find "${data_path}"/locks/ -name '*.lock' -type f -mtime +1 -delete
# remove empty directories # remove empty directories
find "${data_path}"/{attic,cache,index,locks,media,media_attic,media_meta,meta,pages,tmp}/ \ find "${data_path}"/{attic,cache,index,locks,media,media_attic,media_meta,meta,pages,tmp}/ \
-mindepth 1 -type d -empty -delete -mindepth 1 -type d -empty -delete
# remove files older than ${retention_days} days from the cache # remove files older than ${retention_days} days from the cache
if [ -e "${data_path}"/cache/?/ ] if [ ! -z "$(ls -A $data_path/cache)" ]; then
then
find "${data_path}"/cache/?/ -type f -mtime +${retention_days} -delete find "${data_path}"/cache/?/ -type f -mtime +${retention_days} -delete
fi fi
} }