Skip to content

Instantly share code, notes, and snippets.

@TravisBernard
Last active August 18, 2018 21:12
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save TravisBernard/75d2aa584f2b0e72ab42345b5db39d5c to your computer and use it in GitHub Desktop.
Save TravisBernard/75d2aa584f2b0e72ab42345b5db39d5c to your computer and use it in GitHub Desktop.
Clean all the things (M2)
#!/bin/bash
# Derived from
# https://github.com/btford/allthethings
#
# Licensed under WTFPL http://sam.zoy.org/wtfpl/
#
pur=$(tput setaf 5) # Purple
ylw=$(tput setaf 3) # Yellow
txtrst=$(tput sgr0) # Text reset
echo " ${ylw}~= ${txtrst}M?${ylw} ,=~${txtrst}"
echo " ${ylw}== ${txtrst}MD${ylw} ~=~=~${txtrst}"
echo " ${ylw}==== ${txtrst}+${ylw} :=~===${txtrst}"
echo " ${ylw}~====~ ~ ${txtrst}M${ylw} :~======${txtrst}"
echo " ${ylw}~=====~ ~ == ~== ${txtrst}M${ylw} ~========${txtrst}"
echo " ${ylw}~====~~~ ,== ~== ,==== ${txtrst}Z${ylw}~~=========${txtrst}"
echo " ${ylw}=======~=~ ~===, ===~ ===== ${txtrst}=${ylw}==========~${txtrst}"
echo " ${ylw},===========: ~===== :===~ ,======:===${txtrst}~${ylw}~=======~~${txtrst}"
echo " ${ylw}=~=========== ~====== ~==== ,~===========${txtrst}+${ylw}========~${txtrst}"
echo " ${ylw},~=============~=======~===~=~ ~==============${txtrst}M${ylw}=======~${txtrst}"
echo " ${ylw}=============~~======${txtrst}?MNDDM${ylw}~~==========~======${txtrst}M${ylw}~=====~${txtrst}"
echo " ${ylw}================${txtrst}M=,,,,,,,,,D${ylw}~======${txtrst}M N${ylw}=====${txtrst}N${ylw}=====~${txtrst}"
echo " ${ylw}==~ =================~${txtrst}N~,,,,,,,:M8MMMNM O M====${txtrst}~${ylw}=====${txtrst}"
echo " ${ylw},===~, ~=================~~${txtrst}MM~ M M====${txtrst}=${ylw}==== ${txtrst}"
echo " ${ylw}~===~= :=================~${txtrst}N OM M ===${txtrst}?${ylw}~=== ${txtrst}"
echo " ${ylw}~====~~ ==============${txtrst}M M ?M ~ 8Z ~:=${txtrst}N${ylw}~==:${txtrst}"
echo " M ${ylw}~======~=~ ============${txtrst}M O ?M +7MMMMMMMI 8=${txtrst}M${ylw}~==${txtrst}"
echo " NO:7: ${ylw}:======================${txtrst}7 M= MNMMMMMMMMMM +${txtrst}N${ylw}==${txtrst}"
echo "MMO:::::? ${ylw}=======================${txtrst}8M~M ~MMMMMMMMMMMMMM M+${ylw}~~ ,===~${txtrst}"
echo "M,::::::::N ${ylw}=======================${txtrst}N MMMMMMMMMMMMMMMM M~${ylw}= :=~~=~ ~=~~==~${txtrst}"
echo ":,:::::::::Z ${ylw}=====================${txtrst}7 MMMMMMMMMMMMMM M${ylw}===~=====~ ,=~~====${txtrst}"
echo "?:::::::::::M ${ylw}==========================${txtrst}M ~MMMMMMMMMMMM II${ylw}======== :~=======${txtrst}"
echo " ,::::::::::, ${ylw},========================~${txtrst}8 MMMMMMMMMMI M${pur}?M${ylw}====== =======~==${txtrst}"
echo " 8:::::::::::N ${ylw}===~====================+${txtrst}N MMMMMMMMMM I${pur}?I${ylw}===~= ~==========~${txtrst}"
echo " D::::::::: ${ylw}======================${txtrst}MM MMMMMMMMM , I${pur}???M${ylw}==~===========${txtrst}"
echo " N~==OMMZZ7 ${ylw}:================~+${txtrst}M${ylw}===${txtrst}M 8::~, =N M${pur}????D${ylw}============~${txtrst}"
echo " OZZM ${ylw}~===============~==${txtrst}M${ylw}~~=====${txtrst}M O${pur}??????${ylw}===========${txtrst}"
echo " ,MZZM=${ylw}~==================${txtrst}OO${ylw}=~========${txtrst}M~ DD${pur}???????M${ylw}========~${txtrst}"
echo " ~MZZZ?${ylw}===============${txtrst}MM${ylw}=~===========~${txtrst}7?NMMZZNNM7${pur}?I????????7${ylw}~======${txtrst}"
echo " ${ylw}~~~~, ${txtrst}:ZZZM${ylw}============${txtrst}N+${ylw}================${pur}N?????????????????????O${ylw}====~=~~~~~~===~~:,${txtrst}"
echo " ${ylw}=========~,${txtrst}MOZM${ylw}~=======${txtrst}NN${ylw}====================${pur}M????????????????????N${ylw}==========================,${txtrst}"
echo " ${ylw}===========${txtrst}MZZO${ylw}=~===${txtrst}M${ylw}~=~====================~${pur}?????????????????????~${ylw}========================~=~${txtrst}"
echo " ${ylw}~~=========${txtrst}?ZZZNN8${ylw}==========================${pur}MI???????????????????M${ylw}=====================~~${txtrst}"
echo " ${ylw}=============${txtrst}NMZM${ylw}============================${pur}????????????????????O${ylw}=================~${txtrst}"
echo " ${ylw}===========~~${txtrst}MZZO${ylw}~==========================${pur}M????????????????????${ylw}============~,${txtrst}"
echo " ${ylw}=============${txtrst}OZZZN${ylw}=========================${pur}M????????????????????${ylw}~========,${txtrst}"
echo " ${ylw}~============~${txtrst}MZZM${ylw}~~======================${pur}8????????????????????${ylw}~=====${txtrst}"
echo " ${ylw}~============~${txtrst}MZZM${ylw}======================~${pur}?????????????????????${ylw}~~===${txtrst}"
rm -rf var/cache/ var/generation/ var/page_cache/ var/session/ var/view_preprocessed/ pub/static/frontend/ pub/static/adminhtml generated/code
echo "CLEANED ALL THE THINGS"
@lazyguru
Copy link

Consider adding rm -rf generated to support 2.2+. Also:

php bin/magento cache:flush
redis-cli -n 0 flushdb

To handle flushing non-filesystem caches (eg Varnish, etc..)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment