How to Perform a Complex Magento E-Commerce Upgrade – Part 2, “Rock the Diff”

FacebookTwitterGoogle+PinterestWhatsAppStumbleUponShare

The following article is part 2 of a multipart series on performing Complex Magento Upgrades. Part One, Preparation

Now that you’ve done the preparation, let’s begin the migration.

This approach has you carefully choose the modules and theme changes you want. It’s the “Manual Merge” method from Brett’s post on Magento. I prefer this approach to Duntuk’s approach – which works – but overlays the new installation “on top” of your old site. I prefer to carefully pick the changes. It takes more time, but is more “clean” in my opinion.

Here are a few additional links:

  1. Magento Offical Upgrade Process (magentocommerce.com)
  2. Upgrade Trouble shooting (appseconnect.com)
  3. Brett’s Stack Overflow post on Magento (stackoverflow.com)
  4. Theme Review (www.sitepoint.com)

Let’s overwrite our “upgrade” 1.9 database with the current (old site) MySQL database.

First, disable Magento’s caches. Then overwrite the database in the upgrade site.

cat pristine_databases/acme_old.sql | mysql acme_upgrade

And configure the links within Magento for your development domain. 

echo "update core_config_data set value = 'http://upgrade.acme.com/' where path = 'web/unsecure/base_url'; update core_config_data set value = 'http://upgrade.acme.com/' where path = 'web/secure/base_url';" | mysql acme_upgrade
echo "update core_config_data set value = 'matsinc.com' where path = 'web/cookie/cookie_domain'" | mysql acme_upgrade

Run the following SQL to truncate your old logs.

echo "truncate dataflow_batch_export; truncate dataflow_batch_import; truncate log_customer; truncate log_quote; truncate log_summary; truncate log_summary_type; truncate log_url; truncate log_url_info; truncate log_visitor; truncate log_visitor_info; truncate log_visitor_online; truncate report_event; truncate report_viewed_product_index ;truncate report_compared_product_index" | mysql acme_upgrade

Next, install the Open Source command line tools for Magento, “magerun98″.

wget https://raw.github.com/netz98/n98-magerun/master/n98-magerun.phar

Run database upgrade to update the database structure for the new version.

php n98-magerun.phar sys:setup:run

In general, I’ve found these database upgrades work smoothly. Hopefully, by the time it completes, you can view your upgrade site – but without any custom modules or themes.

Now, it’s time to start merging in files from the old (old.acme.com) installation into the new (upgrade.acme.com).

An effective technique I’ve found is to perform a 3-way comparison between pristine1.4.acme.com / old.acme.com / upgrade.acme.com.  With a 3-way comparison, you can clearly see any changes that past developers have made, then synch the changes to the new installation.

Typically, I’ll use the free, kdiff3, which has an excellent visual display for 3-way comparisons. Although it works better on a PC than a Mac, it’s a great tool for complex diffs. However, for 3-way diffs, it’s missing the ability to synchronize entire folders easily.

I recently found Araxis Merge ($269, 30-day evaluation), and I love it. It has a “drill-down” interface which is more linear, but feels more accurate. The key is the ability to click a folder and copy – so you don’t have to visit the shell or Finder.

Again, I’m assuming that you have a complex upgrade and changes are sprinkled throughout the Magento installation. For a simple upgrade – you won’t need these tools.

Start by merging the following folders.

/app/etc/modules/
/app/code/community
/app/code/local
/app/design/frontend

As you make each set of changes, I recommend creating a separate Git commit. This allows you to comment on the merge, and let’s you easily go back to any point in the process.

kdiff3 - 3 way merge

kdiff3 is a free tool to perform 3-way comparison of folders. Visual display (green for a match, red for a mismatch) let’s you quickly see diffs inside folders.

Araxis Merge

Araxis Merge is an excellent tool for performing 3-way merges which require synchronization of entire folders.

test

The ability to Command-click a folder and copy to the second or third location is key with Magento upgrades.

In part 3, I’ll cover, “Common Upgrade Problems”. Stay tuned!

FacebookTwitterGoogle+PinterestWhatsAppStumbleUponShare
Posted in Legacy, Magento