Merge pull request #17646 from james-allan/fix_add_indexes_db_warning
Fix db warnings when using the "Add Order Indexes" tool
This commit is contained in:
commit
a164ff3db5
|
@ -406,15 +406,15 @@ class WC_REST_System_Status_Tools_Controller extends WC_REST_Controller {
|
|||
* that don't have address indexes yet.
|
||||
*/
|
||||
$sql = "INSERT INTO {$wpdb->postmeta}( post_id, meta_key, meta_value )
|
||||
SELECT post_id, '%1\$s', GROUP_CONCAT( meta_value SEPARATOR ' ' )
|
||||
SELECT post_id, '%s', GROUP_CONCAT( meta_value SEPARATOR ' ' )
|
||||
FROM {$wpdb->postmeta}
|
||||
WHERE meta_key IN ( '%2\$s', '%3\$s' )
|
||||
WHERE meta_key IN ( '%s', '%s' )
|
||||
AND post_id IN ( SELECT DISTINCT post_id FROM {$wpdb->postmeta}
|
||||
WHERE post_id NOT IN ( SELECT post_id FROM {$wpdb->postmeta} WHERE meta_key='%1\$s' )
|
||||
AND post_id IN ( SELECT post_id FROM {$wpdb->postmeta} WHERE meta_key='%3\$s' ) )
|
||||
WHERE post_id NOT IN ( SELECT post_id FROM {$wpdb->postmeta} WHERE meta_key='%s' )
|
||||
AND post_id IN ( SELECT post_id FROM {$wpdb->postmeta} WHERE meta_key='%s' ) )
|
||||
GROUP BY post_id";
|
||||
$rows = $wpdb->query( $wpdb->prepare( $sql, '_billing_address_index', '_billing_first_name', '_billing_last_name' ) );
|
||||
$rows += $wpdb->query( $wpdb->prepare( $sql, '_shipping_address_index', '_shipping_first_name', '_shipping_last_name' ) );
|
||||
$rows = $wpdb->query( $wpdb->prepare( $sql, '_billing_address_index', '_billing_first_name', '_billing_last_name', '_billing_address_index', '_billing_last_name' ) );
|
||||
$rows += $wpdb->query( $wpdb->prepare( $sql, '_shipping_address_index', '_shipping_first_name', '_shipping_last_name', '_shipping_address_index', '_shipping_last_name') );
|
||||
|
||||
$message = sprintf( __( '%d indexes added', 'woocommerce' ), $rows );
|
||||
break;
|
||||
|
|
Loading…
Reference in New Issue