Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
### 1.2.0: March 16th, 2022
* Add `--no-db` and `--no-assets` flags
* Add support for optionally skipping the database or assets with new flags: `--no-db` and `--no-assets`
* Pass `--default-character-set=utf8mb4` to `wp db export`
* Pass `--all-tables-with-prefix` to `wp search-replace`, props @joshuafredrickson

### 1.1.0: February 21st, 2019
* Support for local development without a VM (Valet, etc). by passing `--local` at the end of the arguments
Expand Down
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,12 @@ $ ./sync.sh production staging
$ ./sync.sh staging production
```

### Skipping database or assets during sync

The `--skip-db` flag can be passed at the end of the arguments to skip syncing the database.

The `--skip-assets` flag can be passed at the end of the arguments to skip syncing assets.

### Local development without VM (Valet, etc.)

The `--local` flag can be passed at the end of the arguments to skip using WP-CLI aliases for development. This means that you can use the sync script on a local development setup such as Valet.
Expand Down
12 changes: 6 additions & 6 deletions sync-kinsta.sh
Original file line number Diff line number Diff line change
Expand Up @@ -137,17 +137,17 @@ if [[ "$response" =~ ^([yY][eE][sS]|[yY])$ ]]; then
wp db export --default-character-set=utf8mb4 &&
wp db reset --yes &&
wp "@$FROM" db export --default-character-set=utf8mb4 - | wp db import - &&
wp search-replace "$FROMSITE" "$TOSITE"
wp search-replace "$FROMSITE" "$TOSITE" --all-tables-with-prefix
elif [[ "$LOCAL" = true && $FROM == "development" ]]; then
wp "@$TO" db export --default-character-set=utf8mb4 &&
wp "@$TO" db reset --yes &&
wp db export --default-character-set=utf8mb4 - | wp "@$TO" db import - &&
wp "@$TO" search-replace "$FROMSITE" "$TOSITE"
wp "@$TO" search-replace "$FROMSITE" "$TOSITE" --all-tables-with-prefix
else
wp "@$TO" db export --default-character-set=utf8mb4 &&
wp "@$TO" db reset --yes &&
wp "@$FROM" db export --default-character-set=utf8mb4 - | wp "@$TO" db import - &&
wp "@$TO" search-replace "$FROMSITE" "$TOSITE"
wp "@$TO" search-replace "$FROMSITE" "$TOSITE" --all-tables-with-prefix
fi

if [ "$NO_DB" = false ]
Expand All @@ -157,17 +157,17 @@ if [[ "$response" =~ ^([yY][eE][sS]|[yY])$ ]]; then
wp db export --default-character-set=utf8mb4 &&
wp db reset --yes &&
wp "@$FROM" db export --default-character-set=utf8mb4 - | wp db import - &&
wp search-replace "$FROMSITE" "$TOSITE"
wp search-replace "$FROMSITE" "$TOSITE" --all-tables-with-prefix
elif [[ "$LOCAL" = true && $FROM == "development" ]]; then
wp "@$TO" db export --default-character-set=utf8mb4 &&
wp "@$TO" db reset --yes &&
wp db export --default-character-set=utf8mb4 - | wp "@$TO" db import - &&
wp "@$TO" search-replace "$FROMSITE" "$TOSITE"
wp "@$TO" search-replace "$FROMSITE" "$TOSITE" --all-tables-with-prefix
else
wp "@$TO" db export --default-character-set=utf8mb4 &&
wp "@$TO" db reset --yes &&
wp "@$FROM" db export --default-character-set=utf8mb4 - | wp "@$TO" db import - &&
wp "@$TO" search-replace "$FROMSITE" "$TOSITE"
wp "@$TO" search-replace "$FROMSITE" "$TOSITE" --all-tables-with-prefix
fi
fi

Expand Down
12 changes: 6 additions & 6 deletions sync.sh
Original file line number Diff line number Diff line change
Expand Up @@ -134,17 +134,17 @@ if [[ "$response" =~ ^([yY][eE][sS]|[yY])$ ]]; then
wp db export --default-character-set=utf8mb4 &&
wp db reset --yes &&
wp "@$FROM" db export --default-character-set=utf8mb4 - | wp db import - &&
wp search-replace "$FROMSITE" "$TOSITE"
wp search-replace "$FROMSITE" "$TOSITE" --all-tables-with-prefix
elif [[ "$LOCAL" = true && $FROM == "development" ]]; then
wp "@$TO" db export --default-character-set=utf8mb4 &&
wp "@$TO" db reset --yes &&
wp db export --default-character-set=utf8mb4 - | wp "@$TO" db import - &&
wp "@$TO" search-replace "$FROMSITE" "$TOSITE"
wp "@$TO" search-replace "$FROMSITE" "$TOSITE" --all-tables-with-prefix
else
wp "@$TO" db export --default-character-set=utf8mb4 &&
wp "@$TO" db reset --yes &&
wp "@$FROM" db export --default-character-set=utf8mb4 - | wp "@$TO" db import - &&
wp "@$TO" search-replace "$FROMSITE" "$TOSITE"
wp "@$TO" search-replace "$FROMSITE" "$TOSITE" --all-tables-with-prefix
fi

if [ "$NO_DB" = false ]
Expand All @@ -154,17 +154,17 @@ if [[ "$response" =~ ^([yY][eE][sS]|[yY])$ ]]; then
wp db export --default-character-set=utf8mb4 &&
wp db reset --yes &&
wp "@$FROM" db export --default-character-set=utf8mb4 - | wp db import - &&
wp search-replace "$FROMSITE" "$TOSITE"
wp search-replace "$FROMSITE" "$TOSITE" --all-tables-with-prefix
elif [[ "$LOCAL" = true && $FROM == "development" ]]; then
wp "@$TO" db export --default-character-set=utf8mb4 &&
wp "@$TO" db reset --yes &&
wp db export --default-character-set=utf8mb4 - | wp "@$TO" db import - &&
wp "@$TO" search-replace "$FROMSITE" "$TOSITE"
wp "@$TO" search-replace "$FROMSITE" "$TOSITE" --all-tables-with-prefix
else
wp "@$TO" db export --default-character-set=utf8mb4 &&
wp "@$TO" db reset --yes &&
wp "@$FROM" db export --default-character-set=utf8mb4 - | wp "@$TO" db import - &&
wp "@$TO" search-replace "$FROMSITE" "$TOSITE"
wp "@$TO" search-replace "$FROMSITE" "$TOSITE" --all-tables-with-prefix
fi
fi

Expand Down