Skip to content

Commit 6a9383a

Browse files
committed
Table: revert #166.
Querying `information_schema` directly exposed issues with SQLite and ModSecurity. A slow query is better than one that may never work or conflicts with a popular security tool. Related: wp-media/wp-rocket#7818
1 parent ccc6f8b commit 6a9383a

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/Database/Table.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -359,8 +359,9 @@ public function exists() {
359359
}
360360

361361
// Query statement to check if table exists.
362-
$query = "SELECT table_name FROM information_schema.TABLES WHERE table_schema = DATABASE() AND table_name = %s LIMIT 1";
363-
$prepared = $db->prepare( $query, $this->table_name );
362+
$query = "SHOW TABLES LIKE %s";
363+
$like = $db->esc_like( $this->table_name );
364+
$prepared = $db->prepare( $query, $like );
364365
$result = $db->get_var( $prepared );
365366

366367
// Does the table exist?

0 commit comments

Comments
 (0)