From ca8a5b2b5966127a9bf841661394735dafa28162 Mon Sep 17 00:00:00 2001 From: ruan <2369127-ruany@users.noreply.gitlab.com> Date: Mon, 13 Mar 2023 19:30:28 +0200 Subject: [PATCH] Print database tables in tables-not-found error page --- error/tables-not-found.php | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/error/tables-not-found.php b/error/tables-not-found.php index 10cfb0e..dfed034 100644 --- a/error/tables-not-found.php +++ b/error/tables-not-found.php @@ -12,7 +12,7 @@

Tables Not Found


- The web interface has connected to the database, but could not find any tables generated by LiteBans. + The web interface has connected to the database, but could not find the tables generated by LiteBans.
This means that the plugin has not successfully connected to this database before with the same configuration. @@ -29,6 +29,7 @@ "driver: H2" with "driver: MySQL") host; if ($host === "localhost" || $host === "127.0.0.1" || $host === "0.0.0.0") { @@ -40,6 +41,26 @@
- Ensure that you are using the latest version of LiteBans.
+ Database tables:"); + $db = new Database($settings, true, true); + try { + $st = $db->conn->query("SELECT * FROM " . $settings->table['bans'] . " LIMIT 1;"); + $st->fetch(); + $st->closeCursor(); + } catch (PDOException $e) { + $st = $db->conn->query("SHOW TABLES;"); + $st->execute(); + $rows = $st->fetchAll(PDO::FETCH_ASSOC); + + foreach ($rows as $row) { + foreach ($row as $k => $v) { + echo("
- $v"); + } + } + $st->closeCursor(); + } + ?>

Try Again