| Server IP : 213.186.33.4 / Your IP : 216.73.216.222 Web Server : Apache System : Linux webm005.cluster103.gra.hosting.ovh.net 6.18.39-ovh-vps-grsec-zfs+ #1 SMP PREEMPT_DYNAMIC Tue Jul 21 12:03:15 CEST 2026 x86_64 User : karinebmkh ( 644538) PHP Version : 8.4.22 Disable Function : _dyuweyrj4,_dyuweyrj4r,dl MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : OFF | Pkexec : OFF Directory : /home/karinebmkh/www2/wp-content/plugins/woocommerce/includes/cli/ |
Upload File : |
<?php
/**
* WC_CLI_Update_Command class file.
*
* @package WooCommerce\CLI
*/
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
/**
* Allows updates via CLI.
*
* @version 3.0.0
* @package WooCommerce
*/
class WC_CLI_Update_Command {
/**
* Registers the update command.
*/
public static function register_commands() {
WP_CLI::add_command( 'wc update', array( 'WC_CLI_Update_Command', 'update' ) );
}
/**
* Runs all pending WooCommerce database updates.
*/
public static function update() {
global $wpdb;
$wpdb->hide_errors();
include_once WC_ABSPATH . 'includes/class-wc-install.php';
include_once WC_ABSPATH . 'includes/wc-update-functions.php';
$current_db_version = get_option( 'woocommerce_db_version' );
$update_count = 0;
foreach ( WC_Install::get_db_update_callbacks() as $version => $update_callbacks ) {
if ( version_compare( $current_db_version, $version, '<' ) ) {
foreach ( $update_callbacks as $update_callback ) {
/* translators: %s: DB update callback key */
WP_CLI::log( sprintf( __( 'Calling update function: %s', 'woocommerce' ), $update_callback ) );
call_user_func( $update_callback );
$update_count ++;
}
}
}
WC_Admin_Notices::remove_notice( 'update' );
/* translators: 1: Number of database updates performed 2: Database version number */
WP_CLI::success( sprintf( __( '%1$d updates complete. Database version is %2$s', 'woocommerce' ), absint( $update_count ), get_option( 'woocommerce_db_version' ) ) );
}
}