You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+9Lines changed: 9 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -110,6 +110,15 @@ $ ./sync.sh production staging
110
110
$ ./sync.sh staging production
111
111
```
112
112
113
+
### Local development without VM (Valet, etc.)
114
+
115
+
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.
*) echo"usage: $0 production development | staging development | development staging | development production | staging production | production staging"&&exit 1 ;;
@@ -40,7 +46,12 @@ if [[ "$response" =~ ^([yY][eE][sS]|[yY])$ ]]; then
40
46
# Make sure both environments are available before we continue
41
47
availfrom() {
42
48
local AVAILFROM
43
-
AVAILFROM=$(wp "@$FROM" option get home 2>&1)
49
+
50
+
if [[ "$LOCAL"=true&&$FROM=="development" ]];then
51
+
AVAILFROM=$(wp option get home 2>&1)
52
+
else
53
+
AVAILFROM=$(wp "@$FROM" option get home 2>&1)
54
+
fi
44
55
if [[ $AVAILFROM==*"Error"* ]];then
45
56
echo"❌ Unable to connect to $FROM"
46
57
exit 1
@@ -52,7 +63,12 @@ if [[ "$response" =~ ^([yY][eE][sS]|[yY])$ ]]; then
52
63
53
64
availto() {
54
65
local AVAILTO
55
-
AVAILTO=$(wp "@$TO" option get home 2>&1)
66
+
if [[ "$LOCAL"=true&&$TO=="development" ]];then
67
+
AVAILTO=$(wp option get home 2>&1)
68
+
else
69
+
AVAILTO=$(wp "@$TO" option get home 2>&1)
70
+
fi
71
+
56
72
if [[ $AVAILTO==*"Error"* ]];then
57
73
echo"❌ Unable to connect to $TO"
58
74
exit 1
@@ -64,10 +80,22 @@ if [[ "$response" =~ ^([yY][eE][sS]|[yY])$ ]]; then
64
80
echo
65
81
66
82
# Export/import database, run search & replace
67
-
wp "@$TO" db export&&
68
-
wp "@$TO" db reset --yes &&
69
-
wp "@$FROM" db export - | wp "@$TO" db import - &&
0 commit comments