Solved

How to manage separate test version of WordPress site..??

Posted on 2015-01-31
9
121 Views
Last Modified: 2015-02-17
I feel like there must be an easier way to handle testing/dev servers separately from live WordPress sites.  Here's the basic, current process I follow now.

If I have a live site at www.domain.com, I create mirror of that site at sandbox.domain.com with a separate database and separate site files, of course, but at that point they're both the same.

Then on the sandbox I can change to a new theme, make new pages, re-arrange things, and get it all setup the way I want the live site to eventually look.  Let's say that takes a week.

During that week, though, new pages/posts were created on the live site, comments, orders in WooCommerce, etc. and this data does not exist on my sandbox site.

What's the best way to get all of the changes I made on my sandbox back to my live site without losing any data or simply re-doing everything I did on the sandbox to the live site (which isn't a great option anyway because during that time the site is in a "re-arrange" mode.)

I'm thinking maybe I could use a MySQL tool like Navicat or MySQL Workbench to sync the live database and sandbox database, and then copy the sandbox site files to the live site, and in theory that should do it..??  Is there a better way?

Any information on this would be greatly appreciated.  Thanks!
0
Comment
Question by:Andrew Angell
9 Comments
 
LVL 3

Expert Comment

by:Marc Alonso
ID: 40582042
1.Under Tools there should be export.
2. Select All content
3. Download Export File (This will spit out a xml file with everything (settings, posts, pages) etc)
4. On the live site site, simply go to Tools
5. Click Import
6. Click Wordpress (install the wordpress importer plugin if asked)
7. Upload the file.

Everything should be restored on the live site.

Hope this helps :)
0
 
LVL 11

Author Comment

by:Andrew Angell
ID: 40582071
Does that add duplicates of existing pages, though, or does it update and add new records based on record IDs?

Also, it's not just a simple matter of restoring data from sandbox to live.  It's the fact that both the live site db and the sandbox db would have changes that need to be synced rather than a one-way restore.

As I mentioned, let's say I'm building in my sandbox site for a week, or even a month or more.  During that time lots of stuff is changing in the sandbox db, but also lots of stuff changing on the live site db.

When it's time to apply the new theme/content to the live site, that's where I'm getting stuck.  I'm going to need to migrate the site files, for one, so I get the theme, child theme, template files, etc. that I may have created, and I'm going to need the sandbox data so the theme functions the way I've configured it on the sandbox, but I need to keep all the content and new data from the live site that came in during that time I was building on the sandbox.
0
 
LVL 70

Expert Comment

by:Jason C. Levine
ID: 40582111
Andrew,

Changes to files should be no big deal.  Assuming everything is functional on test, you just upload the altered files and life goes on.

The database is a bit of a different story.  Generally speaking, theme changes shouldn't touch anything in the wp_posts, _postmeta, _users, _usermeta, etc. tables...just wp_options.  So since you only have one table to worry about you could dump both copies of the table to text and use a diff check tool to extract the differences and import those to live when ready.

A slightly fancier way to do it is via the MySQL-Diff perl module:

http://adamspiers.org/computing/mysqldiff/
0
 
LVL 11

Author Comment

by:Andrew Angell
ID: 40582115
Many themes will use different variations of custom fields and/or page template settings, etc.  In order to get a theme working nicely you have to make adjustments to these settings in the pages/posts, which would then reflect in that data.  So then if I just migrate all the files, the theme might be in place, but the functionality and the layout of things wouldn't be right because it wouldn't have all of those details in the data migrated.  

I'll check this thing out and see if it'll suit my needs.  I was about to play with Navicat's sync tools, too, and see if that might do what i'm after.
0
Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

 
LVL 70

Expert Comment

by:Jason C. Levine
ID: 40582119
In order to get a theme working nicely you have to make adjustments to these settings in the pages/posts, which would then reflect in that data.

<shrug>

My answer still applies in that case, you just have use the perl tool or something like it to merge the changes from local to live gently.  

If you are changing postmeta on a post-by-post or page-by-page basis, though...yikes. Not sure what you would do to content created since you began the process other than merge, download, alter, merge again.
0
 
LVL 11

Author Comment

by:Andrew Angell
ID: 40582121
It's pretty common for themes to use features like that, so yeah, when making a change to a new theme, if you want that new theme to actually look and function the way it's meant to, you have to make those adjustments to posts/pages accordingly.  

The perl tool (as well as what i'm seeing in navicat) looks like a one-way tool.  Seems that it would be used to keep an up-to-date copy of one database to another database.  

What I need, though, is a two-way sync.  If I simply make all of the changes on my sandbox and then migrate that back directly I would lose any posts, comments, pages, etc. that were added on the live site while I was working on the sandbox.

Unless I'm wrong about that?  Does the perl tool work with two-way sync and I'm just not seeing that?
0
 
LVL 70

Expert Comment

by:Jason C. Levine
ID: 40582124
Mmmm.  Now that I understand better, forget that tool.  I'm thinking navicat is more what you want, possibly Toad:

http://software.dell.com/products/toad-for-mysql

There's also a ton of commercial tools for MySQL data merging but they can be pricey ($250 and up).
0
 
LVL 16

Accepted Solution

by:
Lucas Bishop earned 500 total points
ID: 40582733
There are a variety of tools to help you manage multiple Wordpress test environments, for example:
https://github.com/genesis/wordpress
https://github.com/studio24/wordpress-multi-env-config
https://github.com/roots/bedrock

However these lack the ability to merge database changes/content. I'm not familiar with any plugins for Wordpress that provide this functionality, as its something that can really pose a disaster.  There are staging plugins but from what I've seen they Only provide a one-way pull
https://wordpress.org/plugins/sandbox/faq/

Many hosts nowadays provide staging environments for Wordpress that offer simple copy over to production:
https://getflywheel.com/tour/staging-sites/
https://garage.godaddy.com/webpro/wordpress/set-wordpress-staging-site/
http://wpengine.com/one-click-staging/
https://www.siteground.com/tutorials/staging/

And a middle ground option:
Http://wpstagecoach.com
0
 
LVL 11

Author Comment

by:Andrew Angell
ID: 40615749
The wp stagecoach thing looks like the closest to what I'm after.  I already handle creating my own staging sites, it's just the data migration between the two that's been giving me issues.  They must doing some sort of sync, so I'll just checkout their plugin code and see if I can figure something out for myself.

Thanks!
0

Featured Post

6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

Join & Write a Comment

I want to start by talking about the use of plug-ins for WordPress. I started a web-site for a company I was working for a few years ago; I had extremely basic knowledge of HTML. I am a Graphic Designer by trade so I invited the opportunity as a cha…
Wordpress Horizontal Drop-Down Menu In this tutorial I will show you had to add a WordPress horizontal navigation menu to your theme. I have searched and searched for a good tutorial on creating a WordPress nav menu without adding a plug-in or us…
The purpose of this video is to demonstrate how to insert an Iframe into WordPress. This will be demonstrated using a Windows 8 PC. Go to your WordPress login page. This will look like the following: mywebsite.com/wp-login.php : Open Page or Post…
The purpose of this video is to demonstrate how to add AdSense Ads to a WordPress Website, and how to set up WordPress to automatically place Ads in Sidebars. This will be demonstrated using a Windows 8 PC. Log into your AdSense account. : Cli…

707 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now