WC_Install::update()private staticWC 1.0

Push all needed DB updates to the queue for processing.

{} Это метод класса: WC_Install{}

Хуков нет.

Возвращает

null. Ничего.

Использование

$result = WC_Install::update();

Код WC_Install::update() WC 6.4.1

private static function update() {
	$current_db_version = get_option( 'woocommerce_db_version' );
	$loop               = 0;

	foreach ( self::get_db_update_callbacks() as $version => $update_callbacks ) {
		if ( version_compare( $current_db_version, $version, '<' ) ) {
			foreach ( $update_callbacks as $update_callback ) {
				WC()->queue()->schedule_single(
					time() + $loop,
					'woocommerce_run_update_callback',
					array(
						'update_callback' => $update_callback,
					),
					'woocommerce-db-updates'
				);
				$loop++;
			}
		}
	}

	// After the callbacks finish, update the db version to the current WC version.
	$current_wc_version = WC()->version;
	if ( version_compare( $current_db_version, $current_wc_version, '<' ) &&
		! WC()->queue()->get_next( 'woocommerce_update_db_to_current_version' ) ) {
		WC()->queue()->schedule_single(
			time() + $loop,
			'woocommerce_update_db_to_current_version',
			array(
				'version' => $current_wc_version,
			),
			'woocommerce-db-updates'
		);
	}
}