summaryrefslogtreecommitdiff
path: root/installation/apache-cache-purge.sh.example
blob: be1d368419be0e237b532f7e8f07a2e7126fb04c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
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 "$@"