Giter Club home page Giter Club logo

Comments (24)

timbocode avatar timbocode commented on September 23, 2024

Can someone review?

The only change I've made, and all that seems necessary, is to set

public $version = '3.5.3'

in class-woocommerce.php.

from classic-commerce.

bahiirwa avatar bahiirwa commented on September 23, 2024

Change looks fine in includes\class-woocommerce.php. However, I could not find the PR though.

from classic-commerce.

timbocode avatar timbocode commented on September 23, 2024

Yeah, my mistake. I'll explain on Slack. Do you want to go ahead and close this?

from classic-commerce.

timbocode avatar timbocode commented on September 23, 2024

Reopened pending new PR.

from classic-commerce.

 avatar commented on September 23, 2024

When making this change on a test site I get a message in the dashboard:

update

If I click this I get a white screen. No errors logged.

from classic-commerce.

 avatar commented on September 23, 2024

Plugins still show as 0.1.0...

plugins

Status report shows 3.5.3...

status

from classic-commerce.

timbocode avatar timbocode commented on September 23, 2024

The database message will be because the db version has been bumped from 0.1.0 to 3.5.3. I don't know why it should white screen. It worked when I was testing it. I will check this tomorrow.

Re CC version. The CC version and the WC version can be independent of each other. We can start CC at 1.0.0 but ensure that it reports the WC version as 3.5.3. This is the same principle used in ClassicPress. CP is at 1.1.2 but reports version 4.9.x of WP.

from classic-commerce.

 avatar commented on September 23, 2024

Turned on debugging and got this:
Fatal error: Uncaught Error: Call to a member function push_to_queue() on null in /home/robbiema/public_html/wp-content/plugins/classic-commerce/includes/class-wc-install.php:325 Stack trace: #0 /home/robbiema/public_html/wp-content/plugins/classic-commerce/includes/class-wc-install.php(164): WC_Install::update() #1 /home/robbiema/public_html/wp-includes/class-wp-hook.php(286): WC_Install::install_actions('') #2 /home/robbiema/public_html/wp-includes/class-wp-hook.php(310): WP_Hook->apply_filters(NULL, Array) #3 /home/robbiema/public_html/wp-includes/plugin.php(453): WP_Hook->do_action(Array) #4 /home/robbiema/public_html/wp-admin/admin.php(156): do_action('admin_init') #5 {main} thrown in /home/robbiema/public_html/wp-content/plugins/classic-commerce/includes/class-wc-install.php on line 325

from classic-commerce.

 avatar commented on September 23, 2024

I've just downloaded a fresh copy of CC and updated all the files on the site. Now when I change version to 3.5.3 it doesn't prompt me to update the database (and hence there is no error message).

I must have had an old version of some files in there. However, it is still confusing as the plugin page shows CC version 0.1.0, the status page shows CC version 3.5.3 and database version 0.1.0 (but the help message tells me these two should be the same).

from classic-commerce.

bahiirwa avatar bahiirwa commented on September 23, 2024

The update issue is interesting. We can add an HTML text In file to show this is WC 3.5.3 to remove confusion. The plugin version needs to be traceable so 0.1.0 will be fine.

from classic-commerce.

 avatar commented on September 23, 2024

Is there some way to change the status page so it gets the version from the same place as the plugin page?

from classic-commerce.

 avatar commented on September 23, 2024

At the moment it is using this value echo esc_html( $environment['version'] );

from classic-commerce.

bahiirwa avatar bahiirwa commented on September 23, 2024

Is there some way to change the status page so it gets the version from the same place as the plugin page?

Plugin gets version from the comments /**/ on the first file while the status picks from the variable updated via PR. Making it dynamic means we use something like plugin_data(). Ref https://wordpress.stackexchange.com/questions/18268/i-want-to-get-a-plugin-version-number-dynamically

from classic-commerce.

 avatar commented on September 23, 2024

OK - I'll leave that to you coding people. 😉
The other option would be to change the heading in that field to say that the 3.5.3 value is the "Corresponding WC version", or something like that.

from classic-commerce.

timbocode avatar timbocode commented on September 23, 2024

The reason why the updater gives a white screen and the reason for the 'Call to a member function push_to_queue() on null' error is because the requisite code has been removed from 'class-wc-install.php'.

In function init(), the following needs to be added:

add_action( 'init', array( __CLASS__, 'init_background_updater' ), 5 );

and then the following function needs to be added:

public static function init_background_updater() {
  include_once dirname( __FILE__ ) . '/class-wc-background-updater.php';
  self::$background_updater = new WC_Background_Updater();
}

from classic-commerce.

timbocode avatar timbocode commented on September 23, 2024

To update the database (woocommerce_db_version) to the proper version:

Add the following to includes/wc-update-functions.php:

function wc_update_353_db_version() {
  WC_Install::update_db_version( '3.5.3' );
}

Add the following to includes/class-wc-install.php:

'3.5.3' => array(
  'wc_update_353_db_version',
)

at the end of the private static $db_updates array.

from classic-commerce.

timbocode avatar timbocode commented on September 23, 2024

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?

from classic-commerce.

timbocode avatar timbocode commented on September 23, 2024

Regarding the status report, something like this is easy enough to do:

cc_version

from classic-commerce.

 avatar commented on September 23, 2024

Yes, that's good! Let's do that. Both values will be useful to have in a report.

from classic-commerce.

timbocode avatar timbocode commented on September 23, 2024

New issue created #145

from classic-commerce.

timbocode avatar timbocode commented on September 23, 2024

PR #146

Still need thoughts on comment re redundant code above.

from classic-commerce.

bahiirwa avatar bahiirwa commented on September 23, 2024

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.

from classic-commerce.

timbocode avatar timbocode commented on September 23, 2024

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 includes/class-wc-install.php except for the '3.5.3' element.

from classic-commerce.

timbocode avatar timbocode commented on September 23, 2024

I'll move this to a new issue as #143 is closed.

from classic-commerce.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.