diff options
author | Alex Gleason <alex@alexgleason.me> | 2021-04-30 13:17:03 -0500 |
---|---|---|
committer | Alex Gleason <alex@alexgleason.me> | 2021-04-30 13:17:03 -0500 |
commit | 52fc59f125c10ad73b9fd1a0639b6dc5681776ca (patch) | |
tree | 7de32329acbdd4bdf5c753678a2d459c61b58d80 /installation/apache-cache-purge.sh.example | |
parent | a8fa00ef666f574aec8048626aed78a7d62e6915 (diff) | |
parent | 377f84f3678f9c2541fbd4a200cd93c5ab0dea24 (diff) | |
download | pleroma-52fc59f125c10ad73b9fd1a0639b6dc5681776ca.tar.gz pleroma-52fc59f125c10ad73b9fd1a0639b6dc5681776ca.zip |
Merge remote-tracking branch 'upstream/develop' into earmark
Diffstat (limited to 'installation/apache-cache-purge.sh.example')
-rwxr-xr-x | installation/apache-cache-purge.sh.example | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/installation/apache-cache-purge.sh.example b/installation/apache-cache-purge.sh.example new file mode 100755 index 000000000..7b4262875 --- /dev/null +++ b/installation/apache-cache-purge.sh.example @@ -0,0 +1,36 @@ +#!/bin/sh + +# A simple shell script to delete a media from Apache's mod_disk_cache. +# You will likely need to setup a sudo rule like the following: +# +# Cmnd_Alias HTCACHECLEAN = /usr/local/sbin/htcacheclean +# pleroma ALL=HTCACHECLEAN, NOPASSWD: HTCACHECLEAN +# +# Please also ensure you have enabled: +# +# config :pleroma, Pleroma.Web.MediaProxy.Invalidation.Script, url_format: :htcacheclean +# +# which will correctly format the URLs passed to this script for the htcacheclean utility. +# + +SCRIPTNAME=${0##*/} + +# mod_disk_cache directory +CACHE_DIRECTORY="/tmp/pleroma-media-cache" + +## Removes an item via the htcacheclean utility +## $1 - the filename, can be a pattern . +## $2 - the cache directory. +purge_item() { + sudo htcacheclean -v -p "${2}" "${1}" +} # purge_item + +purge() { + for url in $@ + do + echo "$SCRIPTNAME delete \`$url\` from cache ($CACHE_DIRECTORY)" + purge_item "$url" $CACHE_DIRECTORY + done +} + +purge $@ |