Set permissions
#!/bin/sh
if [ -d app/cache ]; then rm -rf app/cache/*; fi
if [ -d app/logs ]; then rm -rf app/logs/*; fi
if [ -d app/spool ]; then rm -rf app/spool/*; fi
# source : https://raw.github.com/everzet/dotfiles/master/scripts/chcache
USER=$(whoami)
APACHE_USER=$(ps axho user,comm|grep -E "httpd|apache"|uniq|grep -v "root"|awk 'END {print $1}')
chcache () {
sudo setfacl -R -m u:www-data:rwx -m u:`whoami`:rwx $1
sudo setfacl -dR -m u:www-data:rwx -m u:`whoami`:rwx $1
echo "- $1 has been properly chmod'ed for $USER and $APACHE_USER"
}
# Symfony2
if [ -d app/cache ]; then chcache "app/cache"; fi
if [ -d app/logs ]; then chcache "app/logs"; fi
if [ -d app/spool ]; then chcache "app/spool"; fi
if [ -d web/uploads ]; then chcache "web/uploads"; fi
if [ -d web/media ]; then chcache "web/media"; fi
if [ -d web/images ]; then chcache "web/images"; fi