Enabled product bundles
This commit is contained in:
21
backend/wordpress/wp-content/plugins/woocommerce/includes/class-wc-install.php
Normal file → Executable file
21
backend/wordpress/wp-content/plugins/woocommerce/includes/class-wc-install.php
Normal file → Executable file
@@ -105,6 +105,10 @@ class WC_Install {
|
||||
'wc_update_340_last_active',
|
||||
'wc_update_340_db_version',
|
||||
),
|
||||
'3.4.3' => array(
|
||||
'wc_update_343_cleanup_foreign_keys',
|
||||
'wc_update_343_db_version',
|
||||
),
|
||||
);
|
||||
|
||||
/**
|
||||
@@ -559,7 +563,22 @@ class WC_Install {
|
||||
|
||||
// Add constraint to download logs if the columns matches.
|
||||
if ( ! empty( $download_permissions_column_type ) && ! empty( $download_log_column_type ) && $download_permissions_column_type === $download_log_column_type ) {
|
||||
$wpdb->query( "ALTER TABLE {$wpdb->prefix}wc_download_log ADD FOREIGN KEY (permission_id) REFERENCES {$wpdb->prefix}woocommerce_downloadable_product_permissions(permission_id) ON DELETE CASCADE" );
|
||||
$fk_result = $wpdb->get_row( "
|
||||
SELECT COUNT(*) AS fk_count
|
||||
FROM information_schema.TABLE_CONSTRAINTS
|
||||
WHERE CONSTRAINT_SCHEMA = '{$wpdb->dbname}'
|
||||
AND CONSTRAINT_NAME = 'fk_wc_download_log_permission_id'
|
||||
AND CONSTRAINT_TYPE = 'FOREIGN KEY'
|
||||
AND TABLE_NAME = '{$wpdb->prefix}wc_download_log'
|
||||
" );
|
||||
if ( 0 === (int) $fk_result->fk_count ) {
|
||||
$wpdb->query( "
|
||||
ALTER TABLE `{$wpdb->prefix}wc_download_log`
|
||||
ADD CONSTRAINT `fk_wc_download_log_permission_id`
|
||||
FOREIGN KEY (`permission_id`)
|
||||
REFERENCES `{$wpdb->prefix}woocommerce_downloadable_product_permissions` (`permission_id`) ON DELETE CASCADE;
|
||||
" );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user