logo

pleroma

My custom branche(s) on git.pleroma.social/pleroma/pleroma git clone https://anongit.hacktivis.me/git/pleroma.git/

apache-cache-purge.sh.example (926B)


  1. #!/bin/sh
  2. # A simple shell script to delete a media from Apache's mod_disk_cache.
  3. # You will likely need to setup a sudo rule like the following:
  4. #
  5. # Cmnd_Alias HTCACHECLEAN = /usr/local/sbin/htcacheclean
  6. # pleroma ALL=HTCACHECLEAN, NOPASSWD: HTCACHECLEAN
  7. #
  8. # Please also ensure you have enabled:
  9. #
  10. # config :pleroma, Pleroma.Web.MediaProxy.Invalidation.Script, url_format: :htcacheclean
  11. #
  12. # which will correctly format the URLs passed to this script for the htcacheclean utility.
  13. #
  14. SCRIPTNAME=${0##*/}
  15. # mod_disk_cache directory
  16. CACHE_DIRECTORY="/tmp/pleroma-media-cache"
  17. ## Removes an item via the htcacheclean utility
  18. ## $1 - the filename, can be a pattern .
  19. ## $2 - the cache directory.
  20. purge_item() {
  21. sudo htcacheclean -v -p "${2}" "${1}"
  22. } # purge_item
  23. purge() {
  24. for url in $@
  25. do
  26. echo "$SCRIPTNAME delete \`$url\` from cache ($CACHE_DIRECTORY)"
  27. purge_item "$url" $CACHE_DIRECTORY
  28. done
  29. }
  30. purge $@