Post by Qphoria » Mon Aug 22, 2011 1:50 am

Congratulations!
All the damn upgrade threads have pushed me to my limits. I've finally merged the upgrade system into the installer. I've also set it so that it will automatically decide if it should install or upgrade based on the existence of the config.php file contents.

So the next version of OpenCart (assuming v1.5.2, but whatever) will have this new upgrade script.

http://screencast.com/t/aMRVFu4jgEx

At this time it is simplified just to have a single upgrade button that runs the upgrade.sql
I want to make it so that it can programmatically determine the existing version and know which upgrade scripts to run. Unfortunately we need to have a static version number to do this. The current VERSION constant is stored in the index.php file, but when you upload the new files, it overwrites the index.php file and the last version is lost.

So my idea is to add the config version to the config.php files during install.
Then compare the index version to the config version and run the upgrade steps from the current version to the new version.

I'm thinking to keep it simple, it can just be added as a comment to the config.php file
like

Code: Select all

// config_version = 1.5.0
at the top of the config file.

So the first upgrade would have to manually choose which version you have.. but after that this new comment will exist.

More demos to follow.

Image
Donate!|OpenCart Basics|GeoZones
Image


User avatar
Administrator

Posts

Joined
Tue Jul 22, 2008 3:02 am

Post by i2Paq » Mon Aug 22, 2011 2:03 am

Awsome!

Norman in 't Veldt
Moderator OpenCart Forums

_________________ READ and Search BEFORE POSTING _________________

Our FREE search: Find your answer FAST!.

[How to] BTW + Verzend + betaal setup.


User avatar
Global Moderator

Posts

Joined
Mon Nov 09, 2009 7:00 pm
Location - Winkel - The Netherlands

Post by Xsecrets » Mon Aug 22, 2011 4:16 am

just out of curiosity will this work back to the 1.4.x versions, and if so will it still not handle options? If not I think that may cause problems as well.

OpenCart commercial mods and development http://spotonsolutions.net
Layered Navigation
Shipment Tracking
Vehicle Year/Make/Model Filter


Guru Member

Posts

Joined
Sun Oct 25, 2009 3:51 am
Location - FL US

Post by Qphoria » Mon Aug 22, 2011 6:05 am

Xsecrets wrote:just out of curiosity will this work back to the 1.4.x versions, and if so will it still not handle options? If not I think that may cause problems as well.
So the current way it has worked thus far is a single upgrade.sql file that had all the changes from 1.3.2 to 1.4.9.x
This was good and bad...
good since it was all in one file and easy to just append to the end
bad since some tables got overwritten with changes made in 1.4.4 even if you are going from 1.4.8 to 1.4.9 because everything always runs since the things you can do with plain sql is very limited. It was designed to run the entire script every time you upgraded and had code in place to ignore changes that didn't apply..
brilliantly creative ( :dance: ) but hacky to the extreme!

So the plan is to add a separate upgrade.sql script for each version:

upgrade_140_to_142.sql
upgrade_142_to_144.sql
upgrade_144_to_145.sql
upgrade_145_to_146.sql
upgrade_146_to_147.sql
upgrade_147_to_148.sql
upgrade_148_to_149.sql
upgrade_1491_to_1492.sql
upgrade_1492_to_1495.sql
upgrade_1495_to_150.sql
upgrade_150_to_151.sql
etc

Then have a glob command read each of those into a checkbox list
And for the first time run, you choose which scripts you need to run... and they will run in order.
There will be added code for the 1495 to 150 version about the inability to copy product options. Tho I may actually start looking into adding the option conversion code now that I've spent more time with 1.5.x and understand it a bit more, and then it won't be a problem and everyone can STFU! :)

Image
Donate!|OpenCart Basics|GeoZones
Image


User avatar
Administrator

Posts

Joined
Tue Jul 22, 2008 3:02 am

Post by Xsecrets » Mon Aug 22, 2011 6:21 am

Qphoria wrote: There will be added code for the 1495 to 150 version about the inability to copy product options. Tho I may actually start looking into adding the option conversion code now that I've spent more time with 1.5.x and understand it a bit more, and then it won't be a problem and everyone can STFU! :)
well I only mentioned it because you know how well people read. Even if you make it big blinking red letters and force them to check a checkbox they'll turn around and say I didn't realize I would lose my options.

OpenCart commercial mods and development http://spotonsolutions.net
Layered Navigation
Shipment Tracking
Vehicle Year/Make/Model Filter


Guru Member

Posts

Joined
Sun Oct 25, 2009 3:51 am
Location - FL US

Post by Qphoria » Mon Aug 22, 2011 6:24 am

Xsecrets wrote:
Qphoria wrote: There will be added code for the 1495 to 150 version about the inability to copy product options. Tho I may actually start looking into adding the option conversion code now that I've spent more time with 1.5.x and understand it a bit more, and then it won't be a problem and everyone can STFU! :)
well I only mentioned it because you know how well people read. Even if you make it big blinking red letters and force them to check a checkbox they'll turn around and say I didn't realize I would lose my options.
True dat... tho I'm thinking I'll add like 15 javascript alert boxes that popup all around the screen with the same message in multiple languages and rephrase the wording in each one :)
But a full option conversion solution would be the ultimate way to stop illiteracy at the source... by not requiring people to have to read :P

Image
Donate!|OpenCart Basics|GeoZones
Image


User avatar
Administrator

Posts

Joined
Tue Jul 22, 2008 3:02 am

Post by Xsecrets » Mon Aug 22, 2011 7:42 am

Qphoria wrote:But a full option conversion solution would be the ultimate way to stop illiteracy at the source... by not requiring people to have to read :P
yeah and for the most part it should be possible, though due to the nature of the data changes it won't ever work perfect in every situation, since you will have to do some name matching if people have different spellings then things will get a bit goofy.

OpenCart commercial mods and development http://spotonsolutions.net
Layered Navigation
Shipment Tracking
Vehicle Year/Make/Model Filter


Guru Member

Posts

Joined
Sun Oct 25, 2009 3:51 am
Location - FL US

Post by Johnathan » Mon Aug 22, 2011 8:47 pm

Cool! I really like your implementation.

Image
Image Image Image Image


User avatar
Global Moderator

Posts

Joined
Fri Dec 18, 2009 3:08 am


Post by JNeuhoff » Fri Aug 26, 2011 7:46 pm

Will your new upgrade script also take care of additional DB fields or tables? There are quite a few addon modules which automatically add additional DB fields or tables for new features, and I think it shouldn't be too hard to preserve these during an upgrade.

Override Engine * Integrated VQMod * Unused Images Manager * Instant Option Price Calculator * Number Option * Google Rich Snippets * Google Tag Manager * Export/Import Tool * SpamBot Buster * Survey Plus


User avatar
Expert Member

Posts

Joined
Wed Dec 05, 2007 3:38 am


Post by imadam » Fri Aug 26, 2011 11:45 pm

cool sounds good. so does this mean we may be seeing 1.5.2 (or whatever number) very soon?

my opencart carpet cleaning woking guildford and Office Cleaning Services in Guildford


Active Member

Posts

Joined
Sun Jan 10, 2010 10:47 pm
Location - Surrey

Post by Qphoria » Sat Aug 27, 2011 12:08 am

JNeuhoff wrote:Will your new upgrade script also take care of additional DB fields or tables? There are quite a few addon modules which automatically add additional DB fields or tables for new features, and I think it shouldn't be too hard to preserve these during an upgrade.
Actually the whole point behind the way the upgrade script works was designed to preserve any additional tables created by mods. This has been like that since its inception in 1.4.7. The script only applies "changes" to the existing db where changes are needed. Any db tables that aren't affected stay as they were.

Image
Donate!|OpenCart Basics|GeoZones
Image


User avatar
Administrator

Posts

Joined
Tue Jul 22, 2008 3:02 am

Post by Qphoria » Sat Aug 27, 2011 12:08 am

imadam wrote:cool sounds good. so does this mean we may be seeing 1.5.2 (or whatever number) very soon?
nope.. it is just in svn ready to go when daniel decides its ready.

Image
Donate!|OpenCart Basics|GeoZones
Image


User avatar
Administrator

Posts

Joined
Tue Jul 22, 2008 3:02 am

Post by imadam » Sat Aug 27, 2011 12:13 am

ah fair enough. how would this work with modified stores? i assume we'll have to back up everything then go over each modified file to check for differences?

my opencart carpet cleaning woking guildford and Office Cleaning Services in Guildford


Active Member

Posts

Joined
Sun Jan 10, 2010 10:47 pm
Location - Surrey

Post by rofus » Sat Aug 27, 2011 12:43 am

Hi imadam,

that's a good question...I have a heavily modified store (updated to latest 1.4.9.6), with almost all files and libraries changed, some database changes (new tables/fields) and some new sections (both in admin and in catalog) that I created. Till now the upgrades for 1.4 were good enough because I went manually through DB changes, and then I manually checked all the upgrade files and merged modifications.

This will be still possible with 1.5 or we need to go with the beta upgrade scripts (and manual comparison of files) and recreate all the options?

Anyway as usual thanks Qphoria for your hard work!!

New member

Posts

Joined
Wed Feb 09, 2011 10:28 pm

Post by MrSmileyJr » Tue Aug 30, 2011 5:13 am

does that mean that from now on every release will have an upgrade script created BEFORE the release?

Sounds awesome :-)

Never lose data again! Use Dropbox - DO THIS BEFORE YOU SIGNUP for Extra Space!!
http://db.tt/inKP3mv Signing up via this link gives you a bonus of 256 MB
More Bonuses: http://www.dropbox.com/free .5 GB
http://www.dropbox.com/edu = double your bonus referrals by giving an edu address.
Total ~ 3gb


New member

Posts

Joined
Fri Mar 11, 2011 5:07 am

Post by Xsecrets » Tue Aug 30, 2011 6:27 am

MrSmileyJr wrote:does that mean that from now on every release will have an upgrade script created BEFORE the release?

Sounds awesome :-)
There was always an upgrade script before release until 1.5.0 because the changes were so big, so this will just be getting back to SOP.

OpenCart commercial mods and development http://spotonsolutions.net
Layered Navigation
Shipment Tracking
Vehicle Year/Make/Model Filter


Guru Member

Posts

Joined
Sun Oct 25, 2009 3:51 am
Location - FL US

Post by Qphoria » Tue Aug 30, 2011 11:15 am

rofus wrote:Hi imadam,

that's a good question...I have a heavily modified store (updated to latest 1.4.9.6), with almost all files and libraries changed, some database changes (new tables/fields) and some new sections (both in admin and in catalog) that I created. Till now the upgrades for 1.4 were good enough because I went manually through DB changes, and then I manually checked all the upgrade files and merged modifications.

This will be still possible with 1.5 or we need to go with the beta upgrade scripts (and manual comparison of files) and recreate all the options?

Anyway as usual thanks Qphoria for your hard work!!
The process is no different than it has been for the past 2 years. I'm only merging it into the installer to stop all the damn questions about upgrading and smooth out the process a bit. Changes to the core files WILL be overwritten. I certainly hope you are using vQmod for any core changes you make to avoid any issues with upgrades.

As far as DB changes.. the whole design of the way I do the upgrades is so that people with additional db fields won't lose them. The database changes only change the tables they know about. If you added your own table, there is no way the script will know about them and won't be able to change them.

example
If the cart has 3 tables: product, order, customer
and you add your own table: coupon
Then the cart changes product to prod, order to ord, customer to cust... Your table "coupon" is still "coupon"

Image
Donate!|OpenCart Basics|GeoZones
Image


User avatar
Administrator

Posts

Joined
Tue Jul 22, 2008 3:02 am

Post by dony_b » Tue Aug 30, 2011 10:45 pm

What about the template changes ? I spend a lot of time customizing the template and everytime there is a new update I have to redo 80% of work all over again. And you cant use vqmod for all the template changes as it doesn't make.

User avatar
Active Member

Posts

Joined
Wed Aug 18, 2010 9:56 pm
Location - Boston, MA

Post by Qphoria » Tue Aug 30, 2011 11:03 pm

dony_b wrote:What about the template changes ? I spend a lot of time customizing the template and everytime there is a new update I have to redo 80% of work all over again. And you cant use vqmod for all the template changes as it doesn't make.
Then you are doing it wrong. I've had the same theme from 1.4.8 to 1.4.9.6 with only minor bug fixes in the header.tpl
As long as your template files are in your own folder and you are using the template fallback, you should have very little to adjust from 1.5.x to 1.5.x. 80% of themes should be no more than a custom header.tpl file and custom stylesheet. Most of the files aren't changed, but theme makers include them anyway.

1.4.x to 1.5.x is a diff story as a lot of the base design has changed, but that happens only during major version changes.

Image
Donate!|OpenCart Basics|GeoZones
Image


User avatar
Administrator

Posts

Joined
Tue Jul 22, 2008 3:02 am

Post by dony_b » Tue Aug 30, 2011 11:12 pm

Qphoria wrote:
dony_b wrote:What about the template changes ? I spend a lot of time customizing the template and everytime there is a new update I have to redo 80% of work all over again. And you cant use vqmod for all the template changes as it doesn't make.
Then you are doing it wrong. I've had the same theme from 1.4.8 to 1.4.9.6 with only minor bug fixes in the header.tpl
As long as your template files are in your own folder and you are using the template fallback, you should have very little to adjust from 1.5.x to 1.5.x

1.4.x to 1.5.x is a diff story as a lot of the base design has changed, but that happens only during major version changes.
Yes, you are right v1.4.x was really the hardest.

The only difficulty has been the extension, DB and template change but other than that everything else is very minor.

I think think your new upgrade script will be a life saver.

User avatar
Active Member

Posts

Joined
Wed Aug 18, 2010 9:56 pm
Location - Boston, MA
Who is online

Users browsing this forum: No registered users and 1 guest