Skip to content

Commit

Permalink
Fix compatibility problem with MariaDB and older MySQL versions
Browse files Browse the repository at this point in the history
  • Loading branch information
hirasso committed Jun 21, 2024
1 parent e5a072d commit 5cc9e22
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions lib/functions.sh
Original file line number Diff line number Diff line change
Expand Up @@ -327,10 +327,10 @@ function wpRemote() {
local WP_CLI_PHAR=$(getRemoteWPCLIFilename)

# Construct the remote command
local COMMAND="cd $REMOTE_WEB_ROOT && $REMOTE_PHP_BINARY ./$WP_CLI_PHAR $ARGS"
local SSH_COMMAND="ssh $REMOTE_SSH 'cd $REMOTE_WEB_ROOT && $REMOTE_PHP_BINARY $WP_CLI_PHAR $ARGS'"

# Exectute the command
ssh "$REMOTE_SSH" "$COMMAND"
# @see ChatGPT
eval $SSH_COMMAND;
}

# Runs the task file on the remote server
Expand Down Expand Up @@ -359,10 +359,12 @@ function pullDatabase() {
[[ "$PROMPT_RESPONSE" != "y" ]] && exit 1

# Activate maintenance mode
wp maintenance-mode activate &&
wp maintenance-mode activate;

# Import the remote database into the local database
wpRemote db export --default-character-set=utf8mb4 - | wp db import - &&
# Removes lines containing '999999' followed by 'enable the sandbox'
# @see https://mariadb.org/mariadb-dump-file-compatibility-change/
wpRemote db export --default-character-set=utf8mb4 - | sed '/999999.*enable the sandbox/d' | wp db import -;

# Replace the remote URL with the local URL
wp search-replace "//$REMOTE_HOST" "//$LOCAL_HOST" --all-tables-with-prefix
Expand Down

0 comments on commit 5cc9e22

Please sign in to comment.