Last active
June 5, 2019 13:39
-
-
Save wences-dc-uba-ar/ff8ef8a98f0e0225ffb6fd39f8bbcb04 to your computer and use it in GitHub Desktop.
symfony snippets
This file contains 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/bash | |
DEPLOY_DIR=$(basename `pwd`) | |
BUNDLES=$(php7.1 app/console debug:config|egrep -i '\| ([a-z]+) +\|'| cut -f 2 -d ' ') | |
for ENV in dev test preprod; do | |
# prod stage no funca | |
file=/var/www/web/debug-config/$DEPLOY_DIR/$ENV | |
echo $file | |
mkdir -p $(dirname $file) | |
echo "" >$file.yml | |
echo "" >$file-defaults.yml | |
for BUNDLE in $BUNDLES; do | |
echo "########################## $BUNDLE ##########################" >>$file.yml; | |
php7.1 app/console debug:config --env=$ENV $BUNDLE | egrep -v '^$|(=|#|Current config)' | >>$file.yml 2>/dev/null; | |
echo "########################## $BUNDLE ##########################" >>$file-defaults.yml; | |
php7.1 app/console config:dump-reference --env=$ENV $BUNDLE | egrep -v '^$|(=|#|Current config)' | >>$file-defaults.yml 2>/dev/null; | |
done | |
done |
This file contains 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
# symfony clear cache & warmup | |
php7.1 app/console cache:clear && sudo chmod -R a+rwX app/cache/ | |
# quick clear cache | |
sudo rm -rf app/cache/* | |
# quick clear memcache | |
echo -e "flush_all" | netcat -w 3 localhost 11211 |
This file contains 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
# agrega a cada .twig un mensaje para marcar en el html generado la ruta del template.twig que genero la seccion (inicio y fin) | |
# solo inyecta el mensaje en el ambiente dev | |
# | |
# exepciones: | |
# data-operator.html.twig | |
# operator-validator.html.twig | |
# templates que extienden otras (contienen {% extends) | |
# | |
# @TODO: ver como marcar las que extienden a otras tambien | |
# marca al principio | |
find . -iname *.twig \ | |
! -name data-operator.html.twig \ | |
! -name operator-validator.html.twig \ | |
! -exec grep -q '{% extends' \ | |
{} \; \ | |
-exec sed -i '1i{% if app.debug %}\n<!-- twig-debug@dev {} OPEN -->\n{% endif %}' {} \; | |
# marca al final | |
find . -iname *.twig \ | |
! -name data-operator.html.twig \ | |
! -name operator-validator.html.twig \ | |
! -exec grep -q '{% extends' \ | |
{} \; \ | |
-exec sed -i '$a{% if app.debug %}\n<!-- twig-debug@dev {} CLOSE -->\n{% endif %}' {} \; | |
# lista de los twigs que extienden a otras | |
find . -iname *.twig \ | |
! -exec grep -q '{% extends' {} \; \ | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment