Recently we had a client who needed their Magento 1.1 installation upgraded to the latest greatest 1.4. What we thought should be a nice simple task turned into one really long weekend and then some.
Upgrading the database
The initial attempts of using whatever the recommended procedure is proved to fail. Google searches all said the same thing. It broke.
The approach we took ended up being somewhat simple. All done on a development environment.
- Create a separate magento_upgrade database
- Dump the production database and import it into magento_upgrade
- Download and extract magento 1.2, 1.3, and 1.4
- Fix some PHP errors in 1.2 and 1.3
- Run the 1.2 and 1.3 install scripts from the command line
- Go through the 1.4 install
- Rejoice
1. Create a separate magento_upgrade database
In all of the below examples, we'll assume a local mysql database with username root and an empty password.
create database magento_upgrade;
2. Dump the production database and import it into magento_upgrade
Your parameters may vary.
> mysqldump -uroot magento magento_old > old_1.1.sql
> mysql -uroot -Dmagento_upgrade < old_1.1.sql
3. Download and extract magento 1.2, 1.3, and 1.4
Go to Magento Downloads and click on the "Release Archives" tab. Under the 1.3 group, just grab the latest 1.3 and the latest 1.2. I've read after the fact that you may just be able to use 1.3. Your mileage may vary.
4. Fix some PHP errors in 1.2 and 1.3
You need PHP 5.x for the newer Magento. Unfortunately there are some backwards compatibility issues with the older PHP that need to be resolved with magento-1.2 and magento-1.3.
First, in lib/Varien/Object.php, change:
public function ___toString(array $arrAttributes = array(),
$valueSeparator=',')
to this:
public function __invoke(array $arrAttributes = array(),
$valueSeparator=',')
Then bust out your favorite text editor and change all occurrences of split to explode.
5. Run the 1.2 and 1.3 install scripts from the command line
Each tree has an install.php that you can look at for command line reference. For me it went a little something like this:
php -f install.php -- --license_agreement_accepted yes
--encryption_key 90210ff2a6bd4217blahblahblah
--url "http://localhost/magento" --use_rewrites yes
--locale en_US --timezone "America/Chicago"
--default_currency USD --db_host localhost
--db_name magento_upgrade --db_user root -
-db_pass '' --admin_lastname Hinni
--admin_firstname Aaron --admin_email aaron@vedadev.com
--admin_username admin --admin_password anadminpassword
--use_secure no --secure_base_url parameter ''
--use_secure_admin ''
6. Go through the 1.4 install
Once everything works, point your browser to wherever you installed 1.4 and point it to your new database. Hopefully all is well!
7. Rejoice
Well, not quite, as there is the matter of upgrading your theme...
Theme Upgrade
No magic advice here. After just going through this, I highly recommend just starting from scratch creating a new theme/skin based off of base. Good luck!
If you are converting a theme, one of the gotcha's I ran into involved some of the forms not saving. It ended up the form was just missing a hidden form_key field. Add this in the form block:
<?php echo $this->getBlockHtml('formkey')?>
Recent tweet:
Back to using my good friends Ruby, Mechanize and Nokogiri today. Great tools when a RESTful web service is unavailable. – @aaronhinni
Technologies we Rock:
Besides Ruby on Rails, we are well versed with other goodies like Javascript, PHP, Perl, Ruby without the Rails, C/C++, Objective C, Smalltalk, Erlang, and the list goes on and on.
Follow us on facebook