summaryrefslogtreecommitdiff
path: root/installation/apache-cache-purge.sh.example
diff options
context:
space:
mode:
Diffstat (limited to 'installation/apache-cache-purge.sh.example')
-rwxr-xr-xinstallation/apache-cache-purge.sh.example25
1 files changed, 25 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..be1d36841
--- /dev/null
+++ b/installation/apache-cache-purge.sh.example
@@ -0,0 +1,25 @@
+#!/bin/sh
+
+# A simple shell script to delete a media from Apache's mod_disk_cache.
+
+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() {
+ htcacheclean -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 "$@"