From 64e136e9e414b748a54d62d6b595011479550c53 Mon Sep 17 00:00:00 2001 From: Alexander Nell Date: Tue, 19 May 2020 13:45:42 +0200 Subject: [PATCH] Check on error number rather than error message --- core/Configurator/GameModeSettings.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/core/Configurator/GameModeSettings.php b/core/Configurator/GameModeSettings.php index 97f54912..8c9b59cb 100644 --- a/core/Configurator/GameModeSettings.php +++ b/core/Configurator/GameModeSettings.php @@ -98,10 +98,11 @@ class GameModeSettings implements ConfiguratorMenu, CallbackListener, Communicat $renameQuery = "ALTER TABLE `" . self::TABLE_SCRIPT_SETTINGS . "` RENAME TO `" . self::TABLE_GAMEMODE_SETTINGS . "`;"; $result = $mysqli->query($renameQuery); + var_dump($mysqli); if (!$result) { - if (strpos($mysqli->error, "doesn't exist") !== false) { + if ($mysqli->errno === 1146) { // old doesn't exist, good, continue to force creation - } elseif (strpos($mysqli->error, "already exists") !== false) { + } elseif ($mysqli->errno === 1050) { // new one exists, drop the old table, get out $dropQuery = "DROP TABLE `" . self::TABLE_SCRIPT_SETTINGS . "`;"; $result = $mysqli->query($dropQuery);