3 # A simple shell script to delete a media from Apache's mod_disk_cache.
4 # You will likely need to setup a sudo rule like the following:
6 # Cmnd_Alias HTCACHECLEAN = /usr/local/sbin/htcacheclean
7 # pleroma ALL=HTCACHECLEAN, NOPASSWD: HTCACHECLEAN
9 # Please also ensure you have enabled:
11 # config :pleroma, Pleroma.Web.MediaProxy.Invalidation.Script, url_format: :htcacheclean
13 # which will correctly format the URLs passed to this script for the htcacheclean utility.
18 # mod_disk_cache directory
19 CACHE_DIRECTORY
="/tmp/pleroma-media-cache"
21 ## Removes an item via the htcacheclean utility
22 ## $1 - the filename, can be a pattern .
23 ## $2 - the cache directory.
25 sudo htcacheclean
-v -p "${2}" "${1}"
31 echo "$SCRIPTNAME delete \`$url\` from cache ($CACHE_DIRECTORY)"
32 purge_item
"$url" $CACHE_DIRECTORY