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

Commit

Permalink
Add query filter when searching for a table (#2886)
Browse files Browse the repository at this point in the history
* Add query filter when searching for a table

* Fix lint errors
  • Loading branch information
pkelbert authored Jul 22, 2020
1 parent d6a506c commit 6717319
Showing 1 changed file with 2 additions and 2 deletions.
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

0 comments on commit 6717319

Please sign in to comment.