X-Git-Url: http://git.squeep.com/?a=blobdiff_plain;f=installation%2Fapache-cache-purge.sh.example;h=7b426287554566188826e51f1a77a7b4e2a13e5f;hb=1841bd8383d7734cb74cff91f61dc7e1fdfad13d;hp=be1d368419be0e237b532f7e8f07a2e7126fb04c;hpb=003402df401f2bbf46e47017e3b7a2ec27615ea2;p=akkoma diff --git a/installation/apache-cache-purge.sh.example b/installation/apache-cache-purge.sh.example index be1d36841..7b4262875 100755 --- a/installation/apache-cache-purge.sh.example +++ b/installation/apache-cache-purge.sh.example @@ -1,6 +1,17 @@ #!/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##*/} @@ -11,15 +22,15 @@ CACHE_DIRECTORY="/tmp/pleroma-media-cache" ## $1 - the filename, can be a pattern . ## $2 - the cache directory. purge_item() { - htcacheclean -p "${2}" "${1}" + sudo htcacheclean -v -p "${2}" "${1}" } # purge_item purge() { - for url in "$@" + for url in $@ do echo "$SCRIPTNAME delete \`$url\` from cache ($CACHE_DIRECTORY)" purge_item "$url" $CACHE_DIRECTORY done } -purge "$@" +purge $@