Automattic\WooCommerce\Internal\DataStores\Orders

CustomOrdersTableController::process_pre_update_option()privateWC 1.0

Handler for the setting pre-update hook. We use it to verify that authoritative orders table switch doesn't happen while sync is pending.

Method of the class: CustomOrdersTableController{}

No Hooks.

Return

null. Nothing.

Usage

// private - for code of main (parent) class only
$result = $this->process_pre_update_option( $value, $option, $old_value );
$value(mixed) (required)
New value of the setting.
$option(string) (required)
Setting name.
$old_value(mixed) (required)
Old value of the setting.

CustomOrdersTableController::process_pre_update_option() code WC 7.1.0

private function process_pre_update_option( $value, $option, $old_value ) {
	if ( $option !== self::CUSTOM_ORDERS_TABLE_USAGE_ENABLED_OPTION || $value === $old_value || $old_value === false ) {
		return $value;
	}

	/**
	 * Commenting out for better testability.
	$sync_is_pending = 0 !== $this->data_synchronizer->get_current_orders_pending_sync_count();
	if ( $sync_is_pending ) {
		throw new \Exception( "The authoritative table for orders storage can't be changed while there are orders out of sync" );
	}
	 */

	return $value;
}