welaika / wordmove

Multi-stage command line deploy/mirroring and task runner for Wordpress
https://wptools.it/wordmove
MIT License
1.87k stars 165 forks source link

--hex-blob fixes the Invalid Byte Sequence error caused by Wordfence #448

Closed justinmaurerdotdev closed 6 years ago

justinmaurerdotdev commented 6 years ago

I spent the day today working through some of the Wordmove + Wordfence trickiness and I think I've come up with an elegant solution. Specifically, the issue I ran into is that Wordfence stores some data as binary, so the Wordmove adapter fails when it tries to process the dump, as addressed here.

The modification of the adapter file, as recommended by @byron222 on that page, does seem to work. However, blindly replacing non-compatible characters with an empty string leaves me nervous about what we may removing.

Anyway, adding the --hex-blob flag to mysqldump_options seems to perfectly address the issue. It converts all binary columns to hex code, which is conveniently UTF-8-friendly, thereby avoiding any issues with the adapter. I know that this flag has the potential to create larger dump files, but given that it fixes a known Wordmove bug/issue, I wonder if it would be worth including as part of the default dump settings. If nothing else, I would suggest adding mysqldump_options: --hex-blob as a possible workaround on the wiki page I referenced above.

Hope this helps somebody. Cheers.

p.s. If you're looking for other Wordmove + Wordfence tips, the only other advice I have is to create environment-specific versions of wordfence-waf.php and .user.ini (since they include necessary file paths), then add them to your "exclude" list in your Wordmove Movefile.

alessandro-fazzi commented 6 years ago

This sounds really really good to me; I need to study a bit the documentation you linked (thanks) because I'm totally unaware of that options. Sure I'll do and I'll give you a feedback.

alessandro-fazzi commented 6 years ago

Have not tested this approach yet. Sorry but time was badass w/ me last month ;) Keeping open and in the ❤️

alessandro-fazzi commented 6 years ago

@360Zen I've just update the wiki with your contrib. Adding a flag is just too easy and supported, so I think it could be the best approach.

Mamny many many thanks!