rebase on oct-10-2023

This commit is contained in:
Rachit Bhargava
2023-10-10 17:23:21 -04:00
parent d37566ffb6
commit d096058d7d
4789 changed files with 254611 additions and 307223 deletions

View File

@@ -532,16 +532,16 @@ class WC_Coupon_Data_Store_CPT extends WC_Data_Store_WP implements WC_Coupon_Dat
);
$query_for_tentative_usages = $this->get_tentative_usage_query( $coupon->get_id() );
$db_timestamp = $wpdb->get_var( 'SELECT UNIX_TIMESTAMP() FROM DUAL' );
$db_timestamp = $wpdb->get_var( 'SELECT UNIX_TIMESTAMP() FROM ' . $wpdb->posts . ' LIMIT 1' );
$coupon_usage_key = '_coupon_held_' . ( (int) $db_timestamp + $held_time ) . '_' . wp_generate_password( 6, false );
$insert_statement = $wpdb->prepare(
"
INSERT INTO $wpdb->postmeta ( post_id, meta_key, meta_value )
SELECT %d, %s, %s FROM DUAL
SELECT %d, %s, %s FROM $wpdb->posts
WHERE ( $query_for_usages ) + ( $query_for_tentative_usages ) < %d
",
LIMIT 1",
$coupon->get_id(),
$coupon_usage_key,
'',
@@ -629,15 +629,15 @@ class WC_Coupon_Data_Store_CPT extends WC_Data_Store_WP implements WC_Coupon_Dat
); // WPCS: unprepared SQL ok.
$query_for_tentative_usages = $this->get_tentative_usage_query_for_user( $coupon->get_id(), $user_aliases );
$db_timestamp = $wpdb->get_var( 'SELECT UNIX_TIMESTAMP() FROM DUAL' );
$db_timestamp = $wpdb->get_var( 'SELECT UNIX_TIMESTAMP() FROM ' . $wpdb->posts . ' LIMIT 1' );
$coupon_used_by_meta_key = '_maybe_used_by_' . ( (int) $db_timestamp + $held_time ) . '_' . wp_generate_password( 6, false );
$insert_statement = $wpdb->prepare(
"
INSERT INTO $wpdb->postmeta ( post_id, meta_key, meta_value )
SELECT %d, %s, %s FROM DUAL
SELECT %d, %s, %s FROM $wpdb->posts
WHERE ( $query_for_usages ) + ( $query_for_tentative_usages ) < %d
",
LIMIT 1",
$coupon->get_id(),
$coupon_used_by_meta_key,
$user_alias,