ClassicPress / classic-commerce

A simple but powerful e-commerce platform built for ClassicPress. Forked from WooCommerce and compatible with many Woo extensions.
https://classiccommerce.cc/
GNU General Public License v3.0
54 stars 15 forks source link

Remove redundant update code #147

Open timbocode opened 4 years ago

timbocode commented 4 years ago

Regarding includes/wc-update-functions.php and includes/class-wc-install.php, is there a lot of redundant code we can get rid of?

Could everything except the code added above (i.e. everything not related to WC 3.5.3) be removed from both of these files?

Can anyone see any adverse implications of doing this?

This in itself brings a new issue. There is code for WC < 3.0. Do we want to maintain this? If we have an answer for this we can then sort out that issue of redundant code too.

Originally posted by @bahiirwa in https://github.com/ClassicPress-research/classic-commerce/issues/143#issuecomment-566935420

timbocode commented 4 years ago

I was just in the process of doing a PR for this.

I think there are two separate issues.

Maintaining compatibility for WC < 3.0 is one issue.

But the issue I referred to only affects updates.

The question I am asking is: does the update code in includes/wc-update-functions.php and includes/class-wc-install.php only affect existing WC installations where someone is updating WooCommerce to a later version?

If you installed a clean copy of WooCommerce 3.5.3, would this update code still be required?

EDIT: the code I'm referring to is basically everything in includes/wc-update-functions.php except for the newly added wc_update_353_db_version() function and everything in the $db_updates array in class-wc-install.php except for the '3.5.3' element.

bahiirwa commented 4 years ago

For a clean install, simple answer is no effect whatsoever.

These have an effect if you are moving from an older WC to CC or WC 3.5.3. I am thinking of the folks who have not touched their e-commerce for ages since let's say 3.0.0 and have now chosen to move CC. They need to update their DB.

Questions:

  1. Do we want to support those?
  2. Is this something we should move to a compat plugin?

Answering the above will lead to move code that can be removed as being redundant in code base. It is a big decision. However, initially, we had wanted to have a WC-3.5.3 backward compatible plugin. We could reserve this for CC-2.0.0

timbocode commented 4 years ago

OK, I see your point. Let's leave it as it is for now and tag it for 2.0.