rebase code on oct-10-2023

This commit is contained in:
Rachit Bhargava
2023-10-10 17:51:46 -04:00
parent b16ad94b69
commit 8f1a2c3a66
2197 changed files with 184921 additions and 35568 deletions

View File

@@ -8,10 +8,6 @@
use Automattic\Jetpack\Constants;
use Automattic\WooCommerce\Admin\Notes\Notes;
use Automattic\WooCommerce\Internal\DataStores\Orders\CustomOrdersTableController;
use Automattic\WooCommerce\Internal\DataStores\Orders\DataSynchronizer;
use Automattic\WooCommerce\Internal\DataStores\Orders\OrdersTableDataStore;
use Automattic\WooCommerce\Internal\Features\FeaturesController;
use Automattic\WooCommerce\Internal\ProductAttributesLookup\DataRegenerator;
use Automattic\WooCommerce\Internal\ProductDownloads\ApprovedDirectories\Register as Download_Directories;
use Automattic\WooCommerce\Internal\ProductDownloads\ApprovedDirectories\Synchronize as Download_Directories_Sync;
@@ -238,9 +234,6 @@ class WC_Install {
'7.7.0' => array(
'wc_update_770_remove_multichannel_marketing_feature_options',
),
'8.1.0' => array(
'wc_update_810_migrate_transactional_metadata_for_hpos',
),
);
/**
@@ -487,21 +480,9 @@ class WC_Install {
self::create_tables();
}
$schema = self::get_schema();
$feature_controller = wc_get_container()->get( FeaturesController::class );
if (
$feature_controller->feature_is_enabled( DataSynchronizer::ORDERS_DATA_SYNC_ENABLED_OPTION )
|| $feature_controller->feature_is_enabled( CustomOrdersTableController::CUSTOM_ORDERS_TABLE_USAGE_ENABLED_OPTION )
) {
$schema .= wc_get_container()
->get( OrdersTableDataStore::class )
->get_database_schema();
}
$missing_tables = wc_get_container()
->get( DatabaseUtil::class )
->get_missing_tables( $schema );
->get_missing_tables( self::get_schema() );
if ( 0 < count( $missing_tables ) ) {
if ( $modify_notice ) {
@@ -1161,15 +1142,15 @@ class WC_Install {
$collate = $wpdb->get_charset_collate();
}
$max_index_length = wc_get_container()->get( DatabaseUtil::class )->get_max_index_length();
/*
* Indexes have a maximum size of 767 bytes. Historically, we haven't need to be concerned about that.
* As of WP 4.2, however, they moved to utf8mb4, which uses 4 bytes per character. This means that an index which
* used to have room for floor(767/3) = 255 characters, now only has room for floor(767/4) = 191 characters.
*/
$max_index_length = 191;
$product_attributes_lookup_table_creation_sql = wc_get_container()->get( DataRegenerator::class )->get_table_creation_sql();
$feature_controller = wc_get_container()->get( FeaturesController::class );
$hpos_enabled =
$feature_controller->feature_is_enabled( DataSynchronizer::ORDERS_DATA_SYNC_ENABLED_OPTION ) || $feature_controller->feature_is_enabled( CustomOrdersTableController::CUSTOM_ORDERS_TABLE_USAGE_ENABLED_OPTION );
$hpos_table_schema = $hpos_enabled ? wc_get_container()->get( OrdersTableDataStore::class )->get_database_schema() : '';
$tables = "
CREATE TABLE {$wpdb->prefix}woocommerce_sessions (
session_id bigint(20) unsigned NOT NULL AUTO_INCREMENT,
@@ -1513,7 +1494,6 @@ CREATE TABLE {$wpdb->prefix}wc_category_lookup (
category_id bigint(20) unsigned NOT NULL,
PRIMARY KEY (category_tree_id,category_id)
) $collate;
$hpos_table_schema;
";
return $tables;