diff options
author | lain <lain@soykaf.club> | 2020-05-22 18:32:27 +0000 |
---|---|---|
committer | lain <lain@soykaf.club> | 2020-05-22 18:32:27 +0000 |
commit | 124812282fd908467c9272aa5ab0d163bec7e4b3 (patch) | |
tree | 14b75871553bcf517bd0de6bbfeea4b88df5664d /installation/nginx-cache-purge.sh.example | |
parent | 72189d227f01f7b6e69a947776238931b500c3ed (diff) | |
download | pleroma-revert-6dd1575c.tar.gz |
Revert "Merge branch 'issue/1509' into 'develop'"revert-6dd1575c
This reverts merge request !2539
Diffstat (limited to 'installation/nginx-cache-purge.sh.example')
-rwxr-xr-x | installation/nginx-cache-purge.sh.example | 40 |
1 files changed, 0 insertions, 40 deletions
diff --git a/installation/nginx-cache-purge.sh.example b/installation/nginx-cache-purge.sh.example deleted file mode 100755 index b2915321c..000000000 --- a/installation/nginx-cache-purge.sh.example +++ /dev/null @@ -1,40 +0,0 @@ -#!/bin/sh - -# A simple shell script to delete a media from the Nginx cache. - -SCRIPTNAME=${0##*/} - -# NGINX cache directory -CACHE_DIRECTORY="/tmp/pleroma-media-cache" - -## Return the files where the items are cached. -## $1 - the filename, can be a pattern . -## $2 - the cache directory. -## $3 - (optional) the number of parallel processes to run for grep. -get_cache_files() { - local max_parallel=${3-16} - find $2 -maxdepth 2 -type d | xargs -P $max_parallel -n 1 grep -E Rl "^KEY:.*$1" | sort -u -} - -## Removes an item from the given cache zone. -## $1 - the filename, can be a pattern . -## $2 - the cache directory. -purge_item() { - for f in $(get_cache_files $1 $2); do - echo "found file: $f" - [ -f $f ] || continue - echo "Deleting $f from $2." - rm $f - done -} # purge_item - -purge() { - for url in "$@" - do - echo "$SCRIPTNAME delete \`$url\` from cache ($CACHE_DIRECTORY)" - purge_item $url $CACHE_DIRECTORY - done - -} - -purge $1 |