From 7a69586d910a404859f73c95c9aa91d88fbcf0b6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Peters?= Date: Sun, 11 Feb 2018 15:59:58 +0100 Subject: [PATCH] [Web] Do not break init_db when switching branches --- data/web/inc/init_db.inc.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/data/web/inc/init_db.inc.php b/data/web/inc/init_db.inc.php index 11b486cb..e11729fb 100644 --- a/data/web/inc/init_db.inc.php +++ b/data/web/inc/init_db.inc.php @@ -625,7 +625,11 @@ function init_db_schema() { $stmt = $pdo->query("SHOW TABLES LIKE 'quarantaine'"); $num_results = count($stmt->fetchAll(PDO::FETCH_ASSOC)); if ($num_results != 0) { - $pdo->query("RENAME TABLE `quarantaine` TO `quarantine`"); + $stmt = $pdo->query("SHOW TABLES LIKE 'quarantine'"); + $num_results = count($stmt->fetchAll(PDO::FETCH_ASSOC)); + if ($num_results == 0) { + $pdo->query("RENAME TABLE `quarantaine` TO `quarantine`"); + } } } $stmt = $pdo->query("SHOW TABLES LIKE '" . $table . "'");