Skip to content

Commit

Permalink
Fix #616
Browse files Browse the repository at this point in the history
It's worth to note that we're fixing this problem
with the cost of slowing down the operation.

For me it's solid and it's an acceptable tradeoff,
but on large databases this could visibly decrease
the overall procedure execution speed
  • Loading branch information
alessandro-fazzi committed Dec 30, 2021
1 parent d1b277e commit eb1a41b
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
7 changes: 5 additions & 2 deletions lib/wordmove/wpcli.rb
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,11 @@ def wpcli_search_replace_command(context, config_key)
[
'wp search-replace',
"--path=#{wpcli_config_path(context)}",
context.dig(:remote_options, config_key),
context.dig(:local_options, config_key),
'"\A' + context.dig(:remote_options, config_key) + '\Z"', # rubocop:disable Style/StringConcatenation
'"' + context.dig(:local_options, config_key) + '"', # rubocop:disable Style/StringConcatenation
'--regex-delimiter="|"',
'--regex',
'--precise',
'--quiet',
'--skip-columns=guid',
'--all-tables',
Expand Down
3 changes: 2 additions & 1 deletion spec/wpcli_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,8 @@
it 'returns the expected command' do
a_context[:local_options][:wordpress_path] = fixture_folder_root_relative_path
expect(subject.wpcli_search_replace_command(a_context, :wordpress_path))
.to eq('wp search-replace --path=/path/to/steak /var/www/your_site spec/fixtures --quiet '\
.to eq('wp search-replace --path=/path/to/steak "\A/var/www/your_site\Z" ' \
'"spec/fixtures" --regex-delimiter="|" --regex --precise --quiet ' \
'--skip-columns=guid --all-tables --allow-root')
end

Expand Down

0 comments on commit eb1a41b

Please sign in to comment.