Skip to content

Instantly share code, notes, and snippets.

@e0ipso
Last active December 24, 2015 13:29
Show Gist options
  • Save e0ipso/6805671 to your computer and use it in GitHub Desktop.
Save e0ipso/6805671 to your computer and use it in GitHub Desktop.
Shell alias to reinstall the current D8 site. Carefull! This will delete all your content and configuration and it's for core development purposes only. This alias is meant to be called from the Drupal root. This is a variation on http://alias.sh/drupal-install
# Add this to your .bash_profile / .bashrc / …
# Call this to reinstall a D8 development site.
function drupal-reinstall() {
pass=$(grep "'password' =>" sites/default/settings.php | grep -v '[\*#]'|sort|uniq|cut -f4 -d\');
username=$(grep "'username' =>" sites/default/settings.php | grep -v '[\*#]'|sort|uniq|cut -f4 -d\');
dbname=$(grep "'database' =>" sites/default/settings.php | grep -v '[\*#]'|sort|uniq|cut -f4 -d\');
sudo rm -rf sites/default;
sudo git checkout -- sites/default;
sudo chmod -R 777 sites/default;
sudo chown -R `whoami` sites/default;
sudo git checkout -- sites/default;
sudo chown -R `whoami` sites/default;
#exit;
drush si --db-url=mysql://$username:$pass@localhost/$dbname -y
drush en devel simpletest -y
drush pmu overlay -y
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment