Skip to content

Instantly share code, notes, and snippets.

@Pixep
Last active February 2, 2021 15:10
Show Gist options
  • Save Pixep/d6032fa784cf29af7c0c8d34f22d5c25 to your computer and use it in GitHub Desktop.
Save Pixep/d6032fa784cf29af7c0c8d34f22d5c25 to your computer and use it in GitHub Desktop.
Automated Prestashop 1.7 cache clear
#!/bin/bash
if [ -z "$1" ]; then
echo "Error: Requires exactly 1 argument, the root of your prestashop folder. Aborting."
exit 1
fi
base_dir=$1
# Clear class index in case any override changed
rm ${base_dir}/cache/class_index.php
declare -a cache_dirs=(
"cache/smarty/compile"
"cache/smarty/cache"
"cache/cachefs"
"img/tmp" # You might want to keep tmp images
"themes/*/cache"
"var/cache")
# Clear all cache folder, ignoring 'index.php'
for dir in "${cache_dirs[@]}"
do
echo Cleaning ${base_dir}/${dir}...
find ${base_dir}/${dir} -type f ! -name index.php -delete
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment