Skip to content

Instantly share code, notes, and snippets.

@hiephm
Last active March 7, 2024 12:33
Show Gist options
  • Save hiephm/a275bf33091c50e95bc83945709f9ef0 to your computer and use it in GitHub Desktop.
Save hiephm/a275bf33091c50e95bc83945709f9ef0 to your computer and use it in GitHub Desktop.
## Magento 2
WEBSERVER_GROUP="www-data"
alias m2="bin/magento"
alias m2rmgen="find var/generation -maxdepth 1 -mindepth 1 -type d -not -name 'Magento' -not -name 'Composer' -not -name 'Symfony' -exec rm -rf {} \;"
alias m2en="m2 module:enable"
alias m2s="m2 module:status"
alias m2f="m2 cache:flush"
alias m2up="sudo find var -type d -exec chmod 775 {} \; && sudo find var -type f -exec chmod 664 {} \; && m2en --all && m2 setup:upgrade && m2rmgen && m2f"
alias m2static="sudo rm -rf var/view_preprocessed/* pub/static/frontend/* pub/static/adminhtml/* pub/static/_requirejs/*"
alias m2fixgroup="sudo usermod -aG $WEBSERVER_GROUP `whoami`"
alias m2perm="find var vendor pub/static pub/media app/etc -type f -exec chmod g+w {} \; && find var vendor pub/static pub/media app/etc -type d -exec chmod g+ws {} \; && chown -R :$WEBSERVER_GROUP . && chmod u+x bin/magento"
alias m2perm_sudo="sudo find var vendor pub/static pub/media app/etc -type f -exec chmod g+w {} \; && sudo find var vendor pub/static pub/media app/etc -type d -exec chmod g+ws {} \; && sudo chown -R :$WEBSERVER_GROUP . && sudo chmod u+x bin/magento"
alias m2urn="m2 dev:urn-catalog:generate .idea/misc.xml"
alias m2ut="./vendor/bin/phpunit -c dev/tests/unit/phpunit.xml.dist"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment