
Just an idea, I have seen similar scripts in other PHP programmes so I guess it possible.
I hope to see it done this way in the next releaseQphoria wrote:Well look.. I've never tried to update OpenCart 1.x personally because I haven't had the need. But looking at the steps involved, I really can't believe how much trouble people are having with this.
This is definitely a trick that OpenCart could learn from what I did with ChromiumCart.
I made 2 sql files.
default.sql & upgrade.sql
default.sql is the basic stuff that comes with the first version.... first install
upgrade.sql is the stuff that is added subsequently.
BOTH files are run on fresh install, this allows the new installs to get the basics and the updates
Only the upgrade.sql file is run for upgrades between versions.
So now all changes to the db will go here. It also uses full proper sql so that it can even be run standalone in phpmyadmin. In this file I do all my changes, step by step.
So for example, when I released version 0.8.0
1. People did a full install which ran the default.sql & upgrade.sql
2. Upgrade.sql was blank at this time since it was the first version.
Then as I coded 0.8.1, I made changes to the database to add fields to the product table for dimensions, add tables for special products, related products etc.
So in my upgrade.sql file, I added all these steps, and labeled what each step did and what version of the cart it was for.
Then I set the script to autoexecute during the upgrade process, which was simply logging into the admin panel after uploading the files. The script checks the version in the db vs the version in the files and if they don't match, it runs the upgrade script. Simple! It runs the sql and did whatever else it needed so that people didn't have to be involved.
And since I patched the existing db, there was no backup/restore problems. It also meant that it was a static process that I controlled. So it was the same for everyone.
I welcome you to download the latest version of Chromium and look at the install/upgrade.sql file. It's extremely simple and easy to follow each step and it works 100% of the time. This could apparently be very useful in OpenCart as well.
Users browsing this forum: Amazon [Bot] and 17 guests