Last active
August 29, 2015 14:17
-
-
Save gabesullice/bc2548808f66b2d270b4 to your computer and use it in GitHub Desktop.
Drupal Local Update Script
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
| sitereset () { | |
| source $HOME/sql_slurp.sh | |
| if [[ $# < 2 ]]; then | |
| echo "You must specify at least an alias and a multisite directory name." | |
| return | |
| fi | |
| read -p "Would you like to run updates (y/n)? " updb | |
| alias=$1 | |
| site=$2 | |
| local_dir="$(drush drupal-directory $site)" | |
| echo "cd $local_dir" | |
| cd $local_dir | |
| #echo "drush sql-sync -y --no-cache $alias $site" | |
| echo "SQL Slurping $alias $site ..." | |
| _sql-slurp $alias $site | |
| echo "drush vset --yes preprocess_css 0" | |
| drush vset --yes preprocess_css 0 | |
| echo "drush vset --yes preprocess_js 0" | |
| drush vset --yes preprocess_js 0 | |
| #echo "drush vset --yes admin_menu_cache_client 0" | |
| #drush vset --yes admin_menu_cache_client 0 | |
| echo "drush en -y stage_file_proxy devel ${@:3}" | |
| drush en -y stage_file_proxy devel dblog ${@:3} | |
| if [ "$updb" == "y" ]; then | |
| echo "drush updb -y" | |
| drush updb -y | |
| fi | |
| echo "drush cc all" | |
| drush cc all | |
| } | |
| sitereset "$@" |
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
| sql-slurp () { | |
| derp="^@\w+\.\w+" | |
| if [[ ! $1 =~ $derp ]]; then | |
| printf "Derp, that's not an alias!\n" | |
| return 1 | |
| fi | |
| printf "This will overwrite the $2 database with the $1 database.\n" | |
| printf "\n\t\t*** $1 -> $2 ***\n\n" | |
| sleep 3s | |
| read -p "Are you sure [Y/n]? " -n 1 -r | |
| if [[ $REPLY =~ ^[Yy]$ ]]; then | |
| drush $2 sql-drop -y | |
| printf "\n" | |
| drush $1 sql-dump | pv -br | drush $2 sql-cli -A | |
| fi | |
| printf "\n" | |
| } | |
| sql-slurp "@" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment