Skip to content

Instantly share code, notes, and snippets.

@timplunkett
Created October 23, 2013 18:56

Revisions

  1. timplunkett created this gist Oct 23, 2013.
    29 changes: 29 additions & 0 deletions D8 Reinstall
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,29 @@
    function drupal-install() {
    # Remove existing database
    drush sql-drop -y;
    # Remove existing install
    sudo rm -rf sites/default;
    # Restore the sites/default/default.settings.php file
    sudo git checkout -- sites/default;
    # Temporarily make the sites/default writable by anyone
    sudo chmod -R 777 sites/default;
    # Ensure the owner is the current user, not root user
    sudo chown -R `whoami` sites/default;
    # Now that we own it and can write, change the permissions back to how drupal expects them
    sudo git checkout -- sites/default;
    # But still ensure that we own the folder
    sudo chown -R `whoami` sites/default;

    # Uncomment this to stop here so you can install the UI
    #exit;

    # If you run this command with an argument, it will be the name of the DB
    if [ $1 ] ; then
    drush si --db-url=mysql://root:root@localhost/$1 -y
    else
    drush si --db-url=mysql://root:root@localhost/d8 -y
    fi
    # Install and uninstall common modules
    drush en devel simpletest -y
    drush pmu overlay -y
    }