Upgrade Magento from 1.7 to 1.9
Upgrading magento involves upgrading codebase, data migration, extensions & themes migration and your custom code. You can follow these steps to upgrade your magento installation from 1.7.x to 1.9.x.
For this we have an approach to change directory names at last step to avoid any conflicts and make rollback strategy simple and quick.
Disable Magento Compilation from System > Tools > Compilation > Disable
Disable Magento Cache from System > Cache Management > Select All > Action: Disable > Submit
Turn on Maintenance mode for live store, take database backup and Extract 1.9 files for installation
For this we have an approach to change directory names at last step to avoid any conflicts and make rollback strategy simple and quick.
Assumptions
Directory name for current 1.7 store used in this tutorial is store17, replace all occurrences of it with correct directory name.Steps to Upgrade
First we need to disable compilation and cache for our current store:Disable Magento Compilation from System > Tools > Compilation > Disable
Disable Magento Cache from System > Cache Management > Select All > Action: Disable > Submit
Turn on Maintenance mode for live store, take database backup and Extract 1.9 files for installation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Enable Maintenance Mode | |
touch store17/maintenance.flag | |
# Backup database for rollback | |
mysqldump -u [db_user] -p [db_name] > store17_db_dump.sql | |
# Copy and extract 1.9 tar file to web root | |
tar -xzvf magento-1.9.3.3-xxx-xxxx.tar.gz |
Install 1.9
Install 1.9 in separate directory but keep the database configuration same. It means that when it is asked to input database information while installation, you should provide the information of same database as of live 1.7 store.
We assume the directory name is 'magento19' for 1.9 installation.
Copy folders and files
We need to copy few folders and files from our 1.7 store to this new installation, execute following commands:
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
yes | cp -R store17/app/code/community/* magento19/app/code/community/ | |
yes | cp -R store17/app/code/local/ magento19/app/code/local/ | |
yes | cp -R store17/media/* magento19/media/ | |
# if you have your own themes | |
# Your Theme Folder: ROOT > app > design > frontend > default (package name) > “your_theme” | |
mkdir app/design/frontend/default/your-theme/ | |
yes | cp -R store17/app/design/frontend/default/your-theme/* magento19/app/design/frontend/default/your-theme/ | |
yes | cp -R store17/skin/* magento19/skin/ | |
yes | cp -R store17/app/etc/modules/{custom.xml} magento19/app/etc/modules/ | |
yes | store17/app/design/adminhtml/default/* magento19/app/design/adminhtml/default/ | |
yes | store17/app/js/* magento19/js/* |
Update Base URL & Paths and clear Cache
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
mysql -u [db_user] -p [db_name] | |
UPDATE core_config_data SET value = 'http://www.example.com/' WHERE path LIKE 'web/unsecure/base_url'; | |
UPDATE core_config_data SET value = 'https://www.example.com/' WHERE path LIKE 'web/secure/base_url'; | |
# Backup store17 code and files and change magento19 installation to store17 path | |
mv store17 old17 && mv magento19 store17 && chown -R webserver-user:webserver-user store17 | |
# Clear Cache | |
rm -Rf var/cache | |
rm -Rf var/session |
Rollback
If you want to rollback to 1.7, follow below steps
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
mysql -u {db_user} -p [db_name] < store17_db_dump.sql | |
# Update store17 to any name (e.g. magento) and restore old17 Backup to store17 | |
mv store17 magento && mv old17 store17 && chown -R webserver-user:webserver-user store17 | |
# Disable Maintenance Mode | |
rm store17/maintenance.flag | |
# Clear Cache | |
rm -Rf var/cache | |
rm -Rf var/session |
Conclusion
This looks a happy flow for upgrading magento, we will further discuss how to find and add extensions to the upgraded version.
Feel free to comment for any suggestions and addition to these steps.
Comments
Post a Comment