Created
February 27, 2018 10:23
-
-
Save dennis-f/99b06b45766689f330c7c46e53d64ec5 to your computer and use it in GitHub Desktop.
Tiny script to export most elements (chunks/snippets, tvs, templates etc.) from modx without overwriting any content
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
| #!/bin/bash | |
| # db config | |
| DB_NAME='dbname' | |
| DB_USER='root' | |
| DB_PASS='root' | |
| DB_HOST='localhost' | |
| DB_TABLES='modx_categories modx_categories_closure modx_site_htmlsnippets modx_site_plugins modx_site_snippets modx_site_templates modx_site_tmplvars modx_site_tmplvar_access modx_site_tmplvar_templates' | |
| # date format - used in back-up archive filename | |
| D=$(date +%Y-%m-%d) | |
| # set to exit on error | |
| set -e | |
| # backup the database | |
| mysqldump -u ${DB_USER} -p${DB_PASS} -h ${DB_HOST} ${DB_NAME} ${DB_TABLES} > ${DB_NAME}-${D}-elements.sql |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment