Last active
March 16, 2016 11:37
-
-
Save ifthenelse/1bfecb528cebd045390a to your computer and use it in GitHub Desktop.
Aliases collection for Symfony 2
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# If superuser warn and prompt to continue | |
prompt_exec_as_root () { | |
if [[ `whoami` = 'root' -o $(id -u) == 0 -a -z "$SUDO_COMMAND" ]]; then | |
/bin/echo "Warning: you're running the script as superuser."; | |
/bin/echo "This may cause directory permission issues and you'll probably be unable to access your files anymore. \nIn malmost all the cases you're adviced to run as regular user." | |
/bin/echo "Do you still want to continue? [Yes/No/Abort] (default: No) " | |
read REPLY; | |
else if [[ ! $REPLY -o $REPLY =~ ^[Nn][Oo]?$ -o $REPLY =~ ^[Aa]([Bb][Oo][Rr][Tt])?$ ]]; then | |
/bin/echo "Operation aborted.\n"; | |
exit $E_NOTROOT; | |
else if [[ $REPLY != ^[Yy]([Ee][Ss])?$ ]]; then | |
/bin/echo "Invalid answer.\n"; | |
prompt_exec_as_root; | |
fi | |
else | |
/bin/echo "Greetings $USER, you're not acting as superuser"; | |
fi | |
} | |
# Clear all caches | |
clear_all_caches () { | |
rm -rf app/cache/* | |
rm -rf .sass-cache/* | |
app/console ca:cl --env=prod | |
app/console ca:cl --env=dev | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment