WP Migrate DB Pro 1.7 & CLI Addon 1.3 Released

Just 5 months after our last major release, I’m happy to announce the release of WP Migrate DB Pro 1.7 and CLI addon 1.3. In the past, we’ve struggled with limiting the scope of each release and getting releases out more often (e.g. version 1.6 took 10 months and version 1.5 took 12 months!) but I believe we finally have a handle on it now. I’ll save the details of what we changed in our development processes to make that happen for another post. For now, let’s take a look at what’s new.

Run a Find & Replace on the Current Site

You may recall that Matt Shaw joined us as a full-time product developer in February this year. What you probably don’t know is that we also acquired Matt’s plugin when we hired him: Better Search Replace Pro. I was impressed with the work Matt did on that plugin and its rapid rise in popularity. It just made sense to reach out to him and see if he was interested in selling it and maybe working with us as well.

Matt has been working on incorporating one of Better Search Replace Pro’s features into this latest release of WP Migrate DB Pro. It’s a feature that we’ve had planned for ages: in-place search and replace. Here’s the original GitHub issue:

in-place-find-replace-github-issue

In the above feature request, Damon lays out a very common use-case for in-place search and replace: changing the domain on a staging site that’s becoming the live site. I ran into this plenty when I was a freelance developer and I’m sure many of you have as well.

When you update to 1.7, the first thing you should notice is the new “Find & Replace” option:

mdb-find-replace-screenshot-1

As you can see, you have all of the usual controls: which tables are operated on, which post types are excluded, whether a backup should be saved before running the find and replace, etc. You also get the same progress UI as with the other migration options:

mdb-find-replace-screenshot-2

As you can see, there’s even still a “Pause before finalizing the updates” option, which is a hint of how it works. We duplicate all the tables, run the find and replace on the duplicates, then drop the live tables and rename the duplicates. It’s the same way push and pull works. This makes for a much safer find and replace than operating on live tables.

CLI find-replace Subcommand

We’ve added a new WP-CLI find-replace subcommand to WP Migrate DB Pro (no need to install the CLI addon) that runs the same code as the UI:

$ wp migratedb find-replace --find=http://dev.samueljacksonbeer.com,/Users/bradt/Sites/samueljacksonbeer.com/public --replace=https://samueljacksonbeer.com,/sites/samueljacksonbeer.com/public

See our documentation for more details.

You may be wondering why you would ever use this over WP-CLI’s search-replace command and there’s a few reasons:

  1. Multiple Values: As you can see in the example above, you can provide a comma separated list of strings to find and a comma separated list of strings to replace.
  2. Safety: We run the find & replace on duplicate tables first, then replace the live tables with the duplicates.
  3. Saved Profiles: If you often run the same find & replace you can save it as a profile and just run the profile from the command line.

Auto HTTPS Handling

Most developers don’t bother configuring HTTPS on a dev site. Besides the best practice of having the dev site mirror the production site as closely as possible, there’s really no point. And with so many sites moving to HTTPS these days, it’s common to have a dev site on HTTP and a production site on HTTPS. Before WP Migrate DB Pro 1.7, you had to manually add an additional find and replace to run a migration with WP Migrate DB Pro:

Screen Shot 2016-07-04 at 2.17.48 PM

Not anymore. In 1.7, we detect the protocols of the origin and destination and handle this all in the background.

“Copy to Clipboard” Button

copy-to-clipboard

Prior to 1.7, it was pretty easy to select the contents of the Connection Info box and copy the connection info, but if you were copying it for use on the command line it was really annoying. You essentially had to do it twice, once for the URL and once for the key. Now you can can simply use the “Copy to Clipboard” button and it will copy both to the clipboard with a space between, ready for use on the command line. The UI also now supports pasting the connection info with a space instead of a newline character, so you can use the “Copy to Clipboard” button for both the UI and the command line.

CLI Addon 1.3

cli-addon-1-3

We also made a couple of nice improvements to the CLI addon in this release. There’s now a setting subcommand modelled after WP-CLI’s option command:

wp migratedb setting update license 
wp migratedb setting update push 
wp migratedb setting update pull 

wp migratedb setting get license
wp migratedb setting get push
wp migratedb setting get pull
wp migratedb setting get connection-key

This will satisfy quite a few people who’ve requested a way of setting the license key from the command line and being able to automate the setup of new installs of WordPress. See our documentation for more details.

We’ve also added a profiles subcommand to list saved profiles so you don’t have to load the UI to view them:

cli-profiles-subcommand

See the documentation for more details.

And More

There are lots of other little bug fixes and improvements that were made to WP Migrate DB Pro and its addons for this release, so I highly recommend checking out the full changelogs.

What’s Next?

The main feature planned for WP Migrate DB Pro 1.8 is another Better Search Replace Pro feature: importing SQL files. Again we’ve had this in GitHub for a long time and I know it’s been discussed even further back.

sql-import-github-issue

The plan is for Matt to tackle that SQL import feature. Peter will be reworking some of the code, paving the way for later work on the highly requested Themes & Plugins addon. And in addition to helping Matt and Peter, Jeff will be working on setting up automated acceptance testing so that we can spend less time testing and more time developing.

If you’re as happy as I am with work done on this release, I invite you to thank Matt, Jeff, and Peter in the comments as well as the rest of the team for putting in hours of testing.

About the Author

Brad Touesnard Founder & CEO

As founder of Delicious Brains Inc, Brad has worn many hats. He now spends most of his time managing the product teams and growing the business. Before starting this company, Brad was a freelance web developer, specializing in front-end development.