<?php
/**
 * Check for db updates.
 */
namespace BSD_Split_Pay_Stripe_Connect_Woo\Inc;

// PT-fix-3.7.5 (PC2 #1/4): library-style include — Plugin Check v2.0 flags this
// without the ABSPATH guard. Direct-URL hit would noop (function not called)
// but the guard is required by the wp.org submission ruleset.
defined( 'ABSPATH' ) || exit;

if ( ! function_exists( 'BSD_Split_Pay_Stripe_Connect_Woo\Inc\bsd_scsp_db_update' ) ) {
	/**
	 * @return void
	 */
	function bsd_scsp_db_update() {
		$bsd_split_pay_stripe_connect_woo_back_end = get_option( 'bsd_split_pay_stripe_connect_woo_back_end' );

		if ( ! $bsd_split_pay_stripe_connect_woo_back_end ) {
			$opts = [
				'db_version' => '0.0.0',
			];

			add_option( 'bsd_split_pay_stripe_connect_woo_back_end', $opts );
		}

		if ( ! class_exists( 'BSD_Split_Pay_Stripe_Connect_Woo_Plugin_Updates' ) ) {
			require_once 'admin/plugin-updates/class-db-updates.php';
		}

		$bsd_scsp_plugin_updates = new Admin\BSD_Split_Pay_Stripe_Connect_Woo_Plugin_Updates();
		$bsd_scsp_plugin_updates->bsd_scsp_check_for_db_updates();
	}
}