Skip to content

Instantly share code, notes, and snippets.

@MiquelAdell
Created March 18, 2019 11:32
Show Gist options
  • Save MiquelAdell/cb07691e38f6d06b4d1d555761a75721 to your computer and use it in GitHub Desktop.
Save MiquelAdell/cb07691e38f6d06b4d1d555761a75721 to your computer and use it in GitHub Desktop.
#!/usr/bin/env bash
# drop the database
# this step relies on having a WP CLI installed and configured but one could
# use any other method to get the database
wp @dev db export --add-drop-table dev_database.sql
(cd htdocs/wp-content/themes/project-name; yarn build:production)
(cd htdocs/wp-content/; rm debug.log)
# copy all wp-content content except node modules and cvs related stuff. Please
# note that some content may fall to copy due to excludes
rsync -aphvP --update --delete --cvs-exclude --exclude node_modules/ ~/code/VVV/www/project-name/htdocs/wp-content user@destination-host:/srv/users/user/apps/clients-project-name/public/
# copy the wpml translation management plugin without excludes because there are
# some files being excluded that should not be
rsync -aphvP --update --delete ~/code/VVV/www/project-name/htdocs/wp-content/plugins/wpml-translation-management user@destination-host:/srv/users/user/apps/clients-project-name/public/wp-content/plugins/
# copy the database
rsync -aphvP --update --delete ~/code/VVV/www/project-name/htdocs/dev_database.sql user@destination-host:/srv/users/user/apps/clients-project-name/public/dev_database.sql
wp @staging db import dev_database.sql
wp @staging search-replace "project-name.test" "project-name.com"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment