• Resolved php-supadev

    (@lbdeveloper)


    I have this cron job to automatically update the woocommerce db of all blogs of my WP Multisite installation

    0 0 * * * ./wp site list --field=url --allow-root | xargs -n1 -I % ./wp --allow-root --url=% ./wc update

    But only the main blog’s db gets updated. Is there anything wrong with my command?
    How to troubleshoot this?

    Thx

Viewing 6 replies - 1 through 6 (of 6 total)
  • Not sure if that WP-CLI command in WooCommerce supports the network flag.

    wc update --network

    https://github.com/woocommerce/woocommerce/wiki/Upgrading-the-database-using-WP-CLI

    Thread Starter php-supadev

    (@lbdeveloper)

    @lukefiretoss This is the result

    ./wp --allow-root  wc update --network
    Success: No updates required. Database version is 6.6.0

    Seems that –network has no effect.

    While with my command below, at least tries to update all blogs but fails, maybe it’s because it says there are 2 updates, and maybe they are required before updating the db?

    ./wp site list --field=url --allow-root | xargs -n1 -I % ./wp --allow-root --url=% wc update
    Success: No updates required. Database version is 6.6.0
    Found 2 updates (wc_update_650_approved_download_directories, wc_update_651_approved_download_directories)
    Updating database  100% [==========================================] 0:00 / 0:00
    Success: 2 update functions completed. Database version is 6.4.0
    Found 2 updates (wc_update_650_approved_download_directories, wc_update_651_approved_download_directories)
    Updating database  100% [==========================================] 0:00 / 0:00
    Success: 2 update functions completed. Database version is 6.4.0
    Success: No updates required. Database version is 6.6.0
    Success: No updates required. Database version is 6.6.0
    Found 2 updates (wc_update_650_approved_download_directories, wc_update_651_approved_download_directories)
    Updating database  100% [==========================================] 0:00 / 0:00
    Success: 2 update functions completed. Database version is 6.4.0
    Success: No updates required. Database version is 6.6.0
    • This reply was modified 2 years, 9 months ago by php-supadev.

    Hi @lbdeveloper

    Are your sites managed separately? I’m just trying to get the big picture here, but, usually, all your subsites use the same database (with different prefixes), so when updating it, it should update the database as needed.

    I hope to hear from you soon! All the best,

    Thread Starter php-supadev

    (@lbdeveloper)

    @chiape Yes the db is the same with tables having different prefixes for each blog.
    With “managed separately”, not sure what you mean.

    Anyway the command output above says the db is still 6.4.0 (outdated), apart from the main blog and some other ones that i updated manually from wp-admin.

    From wp-admin of the blogs having outdated db, indeed i see the “Database upgrade required” message

    It looks like at least part of this is due to this bug:

    https://github.com/woocommerce/woocommerce/issues/33262

    DB updates via CLI are not updating the DB version number. Until the fix is released, you may want to update via the UI instead.

    We’ve not heard back from you in a while, so I’m marking this thread closed. Hopefully, the above info was helpful.

    If you have further questions, please feel free to open a new topic.

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Updating WC db via WP-CLI on multisite’ is closed to new replies.