Doug Stewart on 13 Jul 2017 16:21:16 -0700


[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]

Re: [PLUG] The most pernicious bug in WordPress




On Thu, Jul 13, 2017 at 7:01 PM, CJ Fearnley <cjf@linuxforce.net> wrote:
On Thu, Jul 13, 2017 at 06:33:49PM -0400, brent timothy saner wrote:
> On 07/13/2017 06:13 PM, Stephen R Guglielmo wrote:
> > I use wp-cli's search-replace command to do this. I often clone our prod
> > wordpress db to non-prod and wp-cli is how I correct the DB.
> >
> > You can't run a regular search/replace on the DB because data is stored
> > serialized (another "why?!?!?"); wp-cli's handles this correctly.
> >
>
> i just do a mysqldump, sed the dump, and import the edited dump for
> wordpress. works fine for me.

I tried that once. It blew up.

Actually I used vim's search and replace. Maybe sed would work better?



That's because of the serialized values in the wp_options tables. You've got to have a search & replace that knows how to deserialize and re-serialize.

Either that, or make your stage and prod domain names the exact same number of characters so you don't have to worry about updating the serialized fields' character counts. It's a stupid trick, but it works.

Also, WP-CLI is a simple phar, so you should be able to keep a copy in your home directory, regardless of your packaging system or distro.

--
-Doug


___________________________________________________________________________
Philadelphia Linux Users Group         --        http://www.phillylinux.org
Announcements - http://lists.phillylinux.org/mailman/listinfo/plug-announce
General Discussion  --   http://lists.phillylinux.org/mailman/listinfo/plug