Skip to content
This repository has been archived by the owner on Feb 23, 2024. It is now read-only.

Add query filter when searching for a table #2886

Merged
merged 2 commits into from
Jul 22, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/Installer.php
Original file line number Diff line number Diff line change
Expand Up @@ -89,13 +89,13 @@ public function maybe_create_tables() {
protected function maybe_create_table( $table_name, $create_sql ) {
global $wpdb;

if ( in_array( $table_name, $wpdb->get_col( 'SHOW TABLES', 0 ), true ) ) {
if ( in_array( $table_name, $wpdb->get_col( $wpdb->prepare( 'SHOW TABLES LIKE %s', $table_name ), 0 ), true ) ) {
return true;
}

$wpdb->query( $create_sql ); // phpcs:ignore WordPress.DB.PreparedSQL.NotPrepared

return in_array( $table_name, $wpdb->get_col( 'SHOW TABLES', 0 ), true );
return in_array( $table_name, $wpdb->get_col( $wpdb->prepare( 'SHOW TABLES LIKE %s', $table_name ), 0 ), true );
}

/**
Expand Down