Created
May 7, 2020 20:38
-
-
Save markfullmer/745a2086c6ab25690e28842929521a08 to your computer and use it in GitHub Desktop.
Fast Drupal 8+ cache rebuild Docksal command
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
#!/usr/bin/env bash | |
#: exec_target = cli | |
# PROJECT_ROOT and DOCROOT are set as env variables in cli | |
SITE_DIRECTORY="default" | |
DOCROOT_PATH="${PROJECT_ROOT}/${DOCROOT}" | |
SITEDIR_PATH="${DOCROOT_PATH}/sites/${SITE_DIRECTORY}" | |
mysql --user="$MYSQL_USER" --database="$MYSQL_DATABASE" --password="$MYSQL_PASSWORD" -e "SHOW TABLES LIKE 'cache%'" | tail -n +2 | xargs -L1 -I% echo "TRUNCATE TABLE %;" > cache-tables.txt | |
value=`cat cache-tables.txt` | |
rm cache-tables.txt | |
mysql --user="user" --database="default" --password="user" -e "$value" >/dev/null | |
rm -f ${SITEDIR_PATH}/files/css/*.css | |
rm -f ${SITEDIR_PATH}/files/js/*.js | |
rm -f ${SITEDIR_PATH}/files/css/*.css.gz | |
rm -f ${SITEDIR_PATH}/files/js/*.js.gz | |
echo "Cache rebuild complete." |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment