Merge pull request #30745 from woocommerce/fix/usage_of_db_information_schema
Replace usage of "information_schema.tables" with "SHOW TABLES LIKE"
This commit is contained in:
commit
f7f8a8d61c
|
@ -130,16 +130,10 @@ class LookupDataStore {
|
||||||
public function check_lookup_table_exists() {
|
public function check_lookup_table_exists() {
|
||||||
global $wpdb;
|
global $wpdb;
|
||||||
|
|
||||||
$query = $wpdb->prepare(
|
$query = $wpdb->prepare( 'SHOW TABLES LIKE %s', $wpdb->esc_like( $this->lookup_table_name ) );
|
||||||
'SELECT count(*)
|
|
||||||
FROM information_schema.tables
|
|
||||||
WHERE table_schema = DATABASE()
|
|
||||||
AND table_name = %s;',
|
|
||||||
$this->lookup_table_name
|
|
||||||
);
|
|
||||||
|
|
||||||
// phpcs:ignore WordPress.DB.PreparedSQL.NotPrepared
|
// phpcs:ignore WordPress.DB.PreparedSQL.NotPrepared
|
||||||
return (bool) $wpdb->get_var( $query );
|
return $this->lookup_table_name === $wpdb->get_var( $query );
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in New Issue